From 89c5b2369413025e1fe7dfe5c5d0bf3bedd8558d Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Mon, 23 Jul 2012 13:52:57 +0000 Subject: git-svn-id: http://svn.miranda-ng.org/main/trunk@1123 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- !NotAdopted/Tlen/tlen_czaty/AdminWindow.cpp | 490 +++++ !NotAdopted/Tlen/tlen_czaty/AdminWindow.h | 63 + !NotAdopted/Tlen/tlen_czaty/ChatContainer.cpp | 480 +++++ !NotAdopted/Tlen/tlen_czaty/ChatContainer.h | 100 + !NotAdopted/Tlen/tlen_czaty/ChatEvent.cpp | 174 ++ !NotAdopted/Tlen/tlen_czaty/ChatEvent.h | 60 + !NotAdopted/Tlen/tlen_czaty/ChatGroup.cpp | 99 + !NotAdopted/Tlen/tlen_czaty/ChatGroup.h | 55 + !NotAdopted/Tlen/tlen_czaty/ChatRoom.cpp | 68 + !NotAdopted/Tlen/tlen_czaty/ChatRoom.h | 51 + !NotAdopted/Tlen/tlen_czaty/ChatUser.cpp | 83 + !NotAdopted/Tlen/tlen_czaty/ChatUser.h | 49 + !NotAdopted/Tlen/tlen_czaty/ChatWindow.cpp | 2108 ++++++++++++++++++++ !NotAdopted/Tlen/tlen_czaty/ChatWindow.h | 196 ++ !NotAdopted/Tlen/tlen_czaty/FontList.cpp | 206 ++ !NotAdopted/Tlen/tlen_czaty/FontList.h | 90 + !NotAdopted/Tlen/tlen_czaty/HelperDialog.cpp | 589 ++++++ !NotAdopted/Tlen/tlen_czaty/HelperDialog.h | 95 + !NotAdopted/Tlen/tlen_czaty/ManagerWindow.cpp | 1067 ++++++++++ !NotAdopted/Tlen/tlen_czaty/ManagerWindow.h | 93 + !NotAdopted/Tlen/tlen_czaty/Options.cpp | 789 ++++++++ !NotAdopted/Tlen/tlen_czaty/Options.h | 75 + !NotAdopted/Tlen/tlen_czaty/Utils.cpp | 138 ++ !NotAdopted/Tlen/tlen_czaty/Utils.h | 38 + !NotAdopted/Tlen/tlen_czaty/icos/admin.ico | Bin 0 -> 894 bytes .../Tlen/tlen_czaty/icos/administration.ico | Bin 0 -> 894 bytes !NotAdopted/Tlen/tlen_czaty/icos/blank.ico | Bin 0 -> 318 bytes !NotAdopted/Tlen/tlen_czaty/icos/bold.ico | Bin 0 -> 894 bytes !NotAdopted/Tlen/tlen_czaty/icos/chat.ico | Bin 0 -> 894 bytes !NotAdopted/Tlen/tlen_czaty/icos/delete.ico | Bin 0 -> 1406 bytes !NotAdopted/Tlen/tlen_czaty/icos/glowner.ico | Bin 0 -> 894 bytes !NotAdopted/Tlen/tlen_czaty/icos/invite.ico | Bin 0 -> 894 bytes !NotAdopted/Tlen/tlen_czaty/icos/italic.ico | Bin 0 -> 894 bytes !NotAdopted/Tlen/tlen_czaty/icos/message.ico | Bin 0 -> 1406 bytes !NotAdopted/Tlen/tlen_czaty/icos/next.ico | Bin 0 -> 894 bytes !NotAdopted/Tlen/tlen_czaty/icos/options.ico | Bin 0 -> 1406 bytes !NotAdopted/Tlen/tlen_czaty/icos/owner.ico | Bin 0 -> 894 bytes !NotAdopted/Tlen/tlen_czaty/icos/prev.ico | Bin 0 -> 894 bytes !NotAdopted/Tlen/tlen_czaty/icos/r_anon.ico | Bin 0 -> 894 bytes !NotAdopted/Tlen/tlen_czaty/icos/r_memb.ico | Bin 0 -> 894 bytes !NotAdopted/Tlen/tlen_czaty/icos/r_mod.ico | Bin 0 -> 894 bytes !NotAdopted/Tlen/tlen_czaty/icos/registered.ico | Bin 0 -> 894 bytes !NotAdopted/Tlen/tlen_czaty/icos/save.ico | Bin 0 -> 318 bytes !NotAdopted/Tlen/tlen_czaty/icos/search.ico | Bin 0 -> 1406 bytes !NotAdopted/Tlen/tlen_czaty/icos/sendmail.ico | Bin 0 -> 1406 bytes !NotAdopted/Tlen/tlen_czaty/icos/smile.ico | Bin 0 -> 1406 bytes !NotAdopted/Tlen/tlen_czaty/icos/tlenbig.ico | Bin 0 -> 2238 bytes !NotAdopted/Tlen/tlen_czaty/icos/tlensmall.ico | Bin 0 -> 894 bytes !NotAdopted/Tlen/tlen_czaty/icos/underline.ico | Bin 0 -> 894 bytes !NotAdopted/Tlen/tlen_czaty/mucc.cpp | 188 ++ !NotAdopted/Tlen/tlen_czaty/mucc.h | 106 + !NotAdopted/Tlen/tlen_czaty/mucc.rc | 579 ++++++ !NotAdopted/Tlen/tlen_czaty/mucc.vcxproj | 1245 ++++++++++++ !NotAdopted/Tlen/tlen_czaty/mucc_services.cpp | 140 ++ !NotAdopted/Tlen/tlen_czaty/mucc_services.h | 35 + !NotAdopted/Tlen/tlen_czaty/resource.h | 218 ++ 56 files changed, 9767 insertions(+) create mode 100644 !NotAdopted/Tlen/tlen_czaty/AdminWindow.cpp create mode 100644 !NotAdopted/Tlen/tlen_czaty/AdminWindow.h create mode 100644 !NotAdopted/Tlen/tlen_czaty/ChatContainer.cpp create mode 100644 !NotAdopted/Tlen/tlen_czaty/ChatContainer.h create mode 100644 !NotAdopted/Tlen/tlen_czaty/ChatEvent.cpp create mode 100644 !NotAdopted/Tlen/tlen_czaty/ChatEvent.h create mode 100644 !NotAdopted/Tlen/tlen_czaty/ChatGroup.cpp create mode 100644 !NotAdopted/Tlen/tlen_czaty/ChatGroup.h create mode 100644 !NotAdopted/Tlen/tlen_czaty/ChatRoom.cpp create mode 100644 !NotAdopted/Tlen/tlen_czaty/ChatRoom.h create mode 100644 !NotAdopted/Tlen/tlen_czaty/ChatUser.cpp create mode 100644 !NotAdopted/Tlen/tlen_czaty/ChatUser.h create mode 100644 !NotAdopted/Tlen/tlen_czaty/ChatWindow.cpp create mode 100644 !NotAdopted/Tlen/tlen_czaty/ChatWindow.h create mode 100644 !NotAdopted/Tlen/tlen_czaty/FontList.cpp create mode 100644 !NotAdopted/Tlen/tlen_czaty/FontList.h create mode 100644 !NotAdopted/Tlen/tlen_czaty/HelperDialog.cpp create mode 100644 !NotAdopted/Tlen/tlen_czaty/HelperDialog.h create mode 100644 !NotAdopted/Tlen/tlen_czaty/ManagerWindow.cpp create mode 100644 !NotAdopted/Tlen/tlen_czaty/ManagerWindow.h create mode 100644 !NotAdopted/Tlen/tlen_czaty/Options.cpp create mode 100644 !NotAdopted/Tlen/tlen_czaty/Options.h create mode 100644 !NotAdopted/Tlen/tlen_czaty/Utils.cpp create mode 100644 !NotAdopted/Tlen/tlen_czaty/Utils.h create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/admin.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/administration.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/blank.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/bold.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/chat.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/delete.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/glowner.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/invite.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/italic.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/message.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/next.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/options.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/owner.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/prev.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/r_anon.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/r_memb.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/r_mod.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/registered.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/save.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/search.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/sendmail.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/smile.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/tlenbig.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/tlensmall.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/icos/underline.ico create mode 100644 !NotAdopted/Tlen/tlen_czaty/mucc.cpp create mode 100644 !NotAdopted/Tlen/tlen_czaty/mucc.h create mode 100644 !NotAdopted/Tlen/tlen_czaty/mucc.rc create mode 100644 !NotAdopted/Tlen/tlen_czaty/mucc.vcxproj create mode 100644 !NotAdopted/Tlen/tlen_czaty/mucc_services.cpp create mode 100644 !NotAdopted/Tlen/tlen_czaty/mucc_services.h create mode 100644 !NotAdopted/Tlen/tlen_czaty/resource.h (limited to '!NotAdopted/Tlen/tlen_czaty') diff --git a/!NotAdopted/Tlen/tlen_czaty/AdminWindow.cpp b/!NotAdopted/Tlen/tlen_czaty/AdminWindow.cpp new file mode 100644 index 0000000000..a29c6fa2f2 --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/AdminWindow.cpp @@ -0,0 +1,490 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#include "AdminWindow.h" +#include "Utils.h" + + +static INT_PTR CALLBACK UserKickDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + int i; + const char *banOptions[]={"No ban", "1 minute", "5 minutes", "15 minutes", "30 minutes", + "1 hour", "6 hours", "1 day", "3 days", "1 week", "2 weeks", "4 weeks"}; + const int banTime[] = {0, 1, 5, 15, 30, 60, 360, 1440, 4320, 10080, 20160, 40320}; + const char *roleOptions[]={"No role", "Member", "Admin", "Moderator"}; + const int roleMask[] = {0, MUCC_EF_USER_MEMBER, MUCC_EF_USER_ADMIN, MUCC_EF_USER_MODERATOR}; + AdminWindow *adminWindow; + adminWindow = (AdminWindow *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + switch (msg) { + case WM_INITDIALOG: + adminWindow = (AdminWindow *) lParam; + TranslateDialogDefault(hwndDlg); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) adminWindow); + adminWindow->setKickTabHWND(hwndDlg); + for (i=0;i<12;i++) { + SendDlgItemMessage(hwndDlg, IDC_KICK_OPTIONS, CB_ADDSTRING, 0, (LPARAM) banOptions[i]); + } + SendDlgItemMessage(hwndDlg, IDC_KICK_OPTIONS, CB_SETCURSEL, 0, 0); + for (i=0;i<3;i++) { + SendDlgItemMessage(hwndDlg, IDC_ROLE_OPTIONS, CB_ADDSTRING, 0, (LPARAM) roleOptions[i]); + } + SendDlgItemMessage(hwndDlg, IDC_ROLE_OPTIONS, CB_SETCURSEL, 0, 0); + SetDlgItemTextA(hwndDlg, IDC_NICK, adminWindow->getNick()); + return FALSE; + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDOK: + { + char nick[256], reason[256]; + GetDlgItemTextA(hwndDlg, IDC_NICK, nick, sizeof(nick)); + GetDlgItemTextA(hwndDlg, IDC_REASON, reason, sizeof(reason)); + if (strlen(nick)>0) { + int iSel = SendDlgItemMessage(hwndDlg, IDC_KICK_OPTIONS, CB_GETCURSEL, 0, 0); + if (iSel>=0 && iSel<12) { + adminWindow->getParent()->kickAndBan(nick, banTime[iSel] * 60, reason); + } + } + } +// EndDialog(hwndDlg, 1); +// return TRUE; + break; + case IDC_SET_ROLE: + { + char nick[256]; + GetDlgItemTextA(hwndDlg, IDC_NICK, nick, sizeof(nick)); + if (strlen(nick)>0) { + int iSel = SendDlgItemMessage(hwndDlg, IDC_ROLE_OPTIONS, CB_GETCURSEL, 0, 0); + if (iSel>=0 && iSel<3) { + adminWindow->getParent()->setRights(nick, roleMask[iSel]); + } + } + } + break; +// EndDialog(hwndDlg, 1); +// return TRUE; + case IDCANCEL: +// EndDialog(hwndDlg, 0); + return TRUE; + } + break; + case WM_CLOSE: +// EndDialog(hwndDlg, 0); + break; + } + return FALSE; +} + +static INT_PTR CALLBACK UserBrowserDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ int i; + const char *browseOptions[]={"Banned", "Owners", "Administrators", "Members", "Moderators"}; + const int browserFlags[]={MUCC_EF_USER_BANNED, MUCC_EF_USER_OWNER, MUCC_EF_USER_ADMIN, MUCC_EF_USER_MEMBER, MUCC_EF_USER_MODERATOR}; + LVCOLUMN lvCol; + HWND lv; + AdminWindow *adminWindow; + adminWindow = (AdminWindow *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + switch (msg) { + case WM_INITDIALOG: + adminWindow = (AdminWindow *) lParam; + TranslateDialogDefault(hwndDlg); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) adminWindow); + adminWindow->setBrowserTabHWND(hwndDlg); + lv = GetDlgItem(hwndDlg, IDC_LIST); + ListView_SetExtendedListViewStyle(lv, LVS_EX_FULLROWSELECT); + lvCol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; + lvCol.pszText = TranslateT("Login"); + lvCol.cx = 80; + lvCol.iSubItem = 0; + ListView_InsertColumn(lv, 0, &lvCol); + lvCol.pszText = TranslateT("Nick name"); + lvCol.cx = 80; + lvCol.iSubItem = 1; + ListView_InsertColumn(lv, 1, &lvCol); + lvCol.pszText = TranslateT("When"); + lvCol.cx = 95; + lvCol.iSubItem = 2; + ListView_InsertColumn(lv, 2, &lvCol); + lvCol.pszText = TranslateT("Admin"); + lvCol.cx = 80; + lvCol.iSubItem = 2; + ListView_InsertColumn(lv, 3, &lvCol); + lvCol.pszText = TranslateT("Reason"); + lvCol.cx = 70; + lvCol.iSubItem = 2; + ListView_InsertColumn(lv, 5, &lvCol); + lvCol.pszText = TranslateT("Remaining"); + lvCol.cx = 80; + lvCol.iSubItem = 2; + ListView_InsertColumn(lv, 4, &lvCol); + for (i=0;i<(adminWindow->getParent()->getRoomFlags() & MUCC_EF_ROOM_MEMBERS_ONLY ? 4 : 3);i++) { + SendDlgItemMessage(hwndDlg, IDC_OPTIONS, CB_ADDSTRING, 0, (LPARAM) browseOptions[i]); + } + SendDlgItemMessage(hwndDlg, IDC_OPTIONS, CB_SETCURSEL, 0, 0); + return FALSE; + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_SHOW: + int iSel; + iSel = SendDlgItemMessage(hwndDlg, IDC_OPTIONS, CB_GETCURSEL, 0, 0); + if (iSel< 5) { + adminWindow->queryUsers(browserFlags[iSel]); + } + break; +// return TRUE; + case IDCANCEL: +// EndDialog(hwndDlg, 0); + return TRUE; + } + break; + case WM_CLOSE: +// EndDialog(hwndDlg, 0); + break; + case WM_MEASUREITEM: + if (wParam == IDC_LIST) { + MEASUREITEMSTRUCT *lpMis = (MEASUREITEMSTRUCT *) lParam; + lpMis->itemHeight = 16;//GetSystemMetrics(SM_CYSMICON); + return TRUE; + } + break; + case WM_DRAWITEM: + if (wParam == IDC_LIST) { + RECT rc; + int x, w; + TCHAR text[256]; + DRAWITEMSTRUCT *lpDis = (DRAWITEMSTRUCT *) lParam; + switch (lpDis->itemAction) { + default: + case ODA_SELECT: + case ODA_DRAWENTIRE: + if (lpDis->itemState & ODS_SELECTED) { + HBRUSH hBrush = CreateSolidBrush(RGB(0xC2, 0xC8, 0xDA));//0xDAC8C2); + FillRect(lpDis->hDC, &(lpDis->rcItem), hBrush);//(HBRUSH) (COLOR_HIGHLIGHT+1)); + DeleteObject(hBrush); + SetTextColor(lpDis->hDC, 0); + SetBkMode(lpDis->hDC, TRANSPARENT); + } + else { + FillRect(lpDis->hDC, &(lpDis->rcItem), (HBRUSH) (COLOR_WINDOW+1)); + SetTextColor(lpDis->hDC, RGB(0, 0, 0));//GetSysColor(COLOR_WINDOWTEXT)); + SetBkMode(lpDis->hDC, TRANSPARENT); + } + x = lpDis->rcItem.left + 1; + for (int col=0;col<6;col++) { + w = ListView_GetColumnWidth(GetDlgItem(hwndDlg, IDC_LIST), col); + rc.left = x; + rc.top = lpDis->rcItem.top; + rc.bottom = lpDis->rcItem.bottom; + rc.right = x+w-2; + ListView_GetItemText(GetDlgItem(hwndDlg, IDC_LIST), lpDis->itemID, col, text, sizeof(text)/sizeof(TCHAR)); + if (_tcslen(text)==0) { + _tcscpy(text, _TEXT("-")); + } + DrawText(lpDis->hDC, text, (int)_tcslen(text), &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER); + x+=w; + } + break; + } + } + break; + case WM_NOTIFY: + LPNMHDR pNmhdr; + pNmhdr = (LPNMHDR)lParam; + if (pNmhdr->idFrom == IDC_LIST && adminWindow->getBrowserMode() == MUCC_EF_USER_BANNED) { + switch (pNmhdr->code) { + case NM_RCLICK: + { + LVHITTESTINFO hti; + int hitItem; + hti.pt.x=(short)LOWORD(GetMessagePos()); + hti.pt.y=(short)HIWORD(GetMessagePos()); + ScreenToClient(pNmhdr->hwndFrom, &hti.pt); + if ((hitItem = ListView_HitTest(pNmhdr->hwndFrom,&hti)) !=-1) { + LVITEM lvi = {0}; + HMENU hMenu; + int iSelection; + TCHAR nick[256]; + lvi.mask = TVIF_TEXT; + lvi.iItem = hitItem; + lvi.iSubItem = 0; + lvi.pszText = nick; + lvi.cchTextMax = sizeof(nick)/sizeof(TCHAR); + ListView_GetItem(pNmhdr->hwndFrom, &lvi); + hMenu=GetSubMenu(LoadMenu(hInst, MAKEINTRESOURCE(IDR_CHATOPTIONS)), 3); + CallService(MS_LANGPACK_TRANSLATEMENU,(WPARAM)hMenu,0); + iSelection = TrackPopupMenu(hMenu, TPM_RETURNCMD | TPM_TOPALIGN | TPM_LEFTALIGN, (short)LOWORD(GetMessagePos()), (short)HIWORD(GetMessagePos()), 0, hwndDlg, NULL); + DestroyMenu(hMenu); + if (iSelection == ID_USERMENU_UNBAN) { + char* lps1 = Utils::mucc_mir_t2a(nick); + adminWindow->getParent()->unban(lps1); + Utils::mucc_mir_free(lps1); + } + } + + } + break; + } + } + + } + return FALSE; +} + +static INT_PTR CALLBACK AdminDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + HWND hwnd; + TCITEM tci; + HWND tc; + AdminWindow *adminWindow; + adminWindow = (AdminWindow *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + switch (msg) { + case WM_INITDIALOG: + adminWindow = (AdminWindow *) lParam; + TranslateDialogDefault(hwndDlg); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) adminWindow); + SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) muccIcon[MUCC_IDI_ADMINISTRATION]); + + hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_USER_KICK), hwndDlg, UserKickDlgProc, (LPARAM) adminWindow); + SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + ShowWindow(hwnd, SW_SHOW); + + hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_USER_BROWSER), hwndDlg, UserBrowserDlgProc, (LPARAM) adminWindow); + SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + adminWindow->setCurrentTab(0); + adminWindow->setHWND(hwndDlg); + + tc = GetDlgItem(hwndDlg, IDC_TABS); + tci.mask = TCIF_TEXT; + tci.pszText = TranslateT("Administration"); + TabCtrl_InsertItem(tc, 0, &tci); + tci.pszText = TranslateT("Browser"); + TabCtrl_InsertItem(tc, 1, &tci); + + return FALSE; + case WM_NOTIFY: + switch (wParam) { + case IDC_TABS: + switch (((LPNMHDR) lParam)->code) { + case TCN_SELCHANGE: + switch (adminWindow->getCurrentTab()) { + case 0: + ShowWindow(adminWindow->getKickTabHWND(), SW_HIDE); + break; + case 1: + ShowWindow(adminWindow->getBrowserTabHWND(), SW_HIDE); + break; + } + adminWindow->setCurrentTab(TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TABS))); + switch (adminWindow->getCurrentTab()) { + case 0: + ShowWindow(adminWindow->getKickTabHWND(), SW_SHOW); + break; + case 1: + ShowWindow(adminWindow->getBrowserTabHWND(), SW_SHOW); + break; + } + break; + } + break; + } + break; + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDCANCEL: + delete adminWindow; + // EndDialog(hwndDlg, 0); + return TRUE; + } + break; + case WM_CLOSE: + delete adminWindow; + // EndDialog(hwndDlg, 0); + break; + } + return FALSE; +} + + + +AdminWindow::AdminWindow(ChatWindow *parent, const char *nick, int mode) { + this->parent = parent; + hWnd = NULL; + browserMode = 0; + this->nick = NULL; + Utils::copyString(&this->nick, nick); +} + +AdminWindow::~AdminWindow() { + + if (hWnd != NULL) { + EndDialog(hWnd, 0); + } + if (parent != NULL) { + parent->setAdminWindow(NULL); + } + if (nick != NULL) { + delete nick; + } +} + +void AdminWindow::start() { + DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_USER_ADMIN), NULL, AdminDlgProc, (LPARAM) this); +} + +void AdminWindow::setHWND(HWND hWnd) { + this->hWnd = hWnd; +} + +void AdminWindow::setCurrentTab(int t) { + currentTab = t; +} + +int AdminWindow::getCurrentTab() { + return currentTab; +} + + +void AdminWindow::setKickTabHWND(HWND hWnd) { + hKickTabWnd = hWnd; +} + +void AdminWindow::setBrowserTabHWND(HWND hWnd) { + hBrowserTabWnd = hWnd; +} + +HWND AdminWindow::getKickTabHWND() { + return hKickTabWnd; +} + +HWND AdminWindow::getBrowserTabHWND() { + return hBrowserTabWnd; +} + +void AdminWindow::queryUsers(int queryType) { + MUCCEVENT muce; + EnableWindow(GetDlgItem(getBrowserTabHWND(), IDC_SHOW), FALSE); + muce.cbSize = sizeof(MUCCEVENT); + muce.iType = MUCC_EVENT_QUERY_USERS; + muce.pszModule = parent->getModule(); + muce.pszID = parent->getRoomId(); + muce.dwFlags = queryType; + browserMode = queryType; + NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce); +} + +ChatWindow * AdminWindow::getParent() { + return parent; +} + +void AdminWindow::queryResultUsers(MUCCQUERYRESULT *queryResult) { + ListView_DeleteAllItems(GetDlgItem(getBrowserTabHWND(), IDC_LIST)); + for (int i=0;iiItemsNum;i++) { + + char timestampStr[100]; + DBTIMETOSTRING dbtts; + LVITEM lvItem; + + lvItem.mask = LVIF_TEXT;// | LVIF_PARAM; + lvItem.iSubItem = 0; + lvItem.iItem = ListView_GetItemCount(GetDlgItem(getBrowserTabHWND(), IDC_LIST)); + lvItem.pszText = Utils::mucc_mir_a2t(queryResult->pItems[i].pszID); + if (lvItem.pszText == NULL) lvItem.pszText = _TEXT(""); +// lvItem.lParam = (LPARAM) room; + ListView_InsertItem(GetDlgItem(getBrowserTabHWND(), IDC_LIST), &lvItem); + Utils::mucc_mir_free(lvItem.pszText); + + lvItem.iSubItem = 1; + lvItem.pszText = Utils::mucc_mir_a2t(queryResult->pItems[i].pszName); + if (lvItem.pszText == NULL) lvItem.pszText = _TEXT(""); + ListView_InsertItem(GetDlgItem(getBrowserTabHWND(), IDC_LIST), &lvItem); + ListView_SetItemText(GetDlgItem(getBrowserTabHWND(), IDC_LIST), lvItem.iItem, lvItem.iSubItem, lvItem.pszText); + Utils::mucc_mir_free(lvItem.pszText); + + lvItem.iSubItem = 2; + dbtts.cbDest = 90; + dbtts.szDest = timestampStr; + dbtts.szFormat = (char *)"d t"; + timestampStr[0]='\0'; + if (queryResult->pItems[i].dwFlags) { + CallService(MS_DB_TIME_TIMESTAMPTOSTRING, (WPARAM)queryResult->pItems[i].dwFlags, (LPARAM) & dbtts); + } + lvItem.pszText = Utils::mucc_mir_a2t(timestampStr); + if (lvItem.pszText == NULL) lvItem.pszText = _TEXT(""); + ListView_InsertItem(GetDlgItem(getBrowserTabHWND(), IDC_LIST), &lvItem); + ListView_SetItemText(GetDlgItem(getBrowserTabHWND(), IDC_LIST), lvItem.iItem, lvItem.iSubItem, lvItem.pszText); + Utils::mucc_mir_free(lvItem.pszText); + + lvItem.iSubItem = 3; + lvItem.pszText = Utils::mucc_mir_a2t(queryResult->pItems[i].pszNick); + if (lvItem.pszText == NULL) lvItem.pszText = _TEXT(""); + ListView_InsertItem(GetDlgItem(getBrowserTabHWND(), IDC_LIST), &lvItem); + ListView_SetItemText(GetDlgItem(getBrowserTabHWND(), IDC_LIST), lvItem.iItem, lvItem.iSubItem, lvItem.pszText); + Utils::mucc_mir_free(lvItem.pszText); + + lvItem.iSubItem = 4; + timestampStr[0] = '\0'; + if (queryResult->pItems[i].iCount > 0) { + int days = queryResult->pItems[i].iCount / (60*60*24); + int hours = (queryResult->pItems[i].iCount % (60*60*24)) / (60*60); + int minutes = (queryResult->pItems[i].iCount % (60*60)) / 60; + int seconds = queryResult->pItems[i].iCount % 60; + if (days != 0) { + sprintf(timestampStr, "%dd%dh%dm%ds", days, hours, minutes, seconds); + } else if (hours != 0) { + sprintf(timestampStr, "%dh%dm%ds", hours, minutes, seconds); + } else if (minutes != 0) { + sprintf(timestampStr, "%dm%ds", minutes, seconds); + } else { + sprintf(timestampStr, "%ds", seconds); + } + } + lvItem.pszText = Utils::mucc_mir_a2t(timestampStr); + if (lvItem.pszText == NULL) lvItem.pszText = _TEXT(""); + ListView_InsertItem(GetDlgItem(getBrowserTabHWND(), IDC_LIST), &lvItem); + ListView_SetItemText(GetDlgItem(getBrowserTabHWND(), IDC_LIST), lvItem.iItem, lvItem.iSubItem, lvItem.pszText); + Utils::mucc_mir_free(lvItem.pszText); + + lvItem.iSubItem = 5; + lvItem.pszText = Utils::mucc_mir_a2t(queryResult->pItems[i].pszText); + if (lvItem.pszText == NULL) lvItem.pszText = _TEXT(""); + ListView_InsertItem(GetDlgItem(getBrowserTabHWND(), IDC_LIST), &lvItem); + ListView_SetItemText(GetDlgItem(getBrowserTabHWND(), IDC_LIST), lvItem.iItem, lvItem.iSubItem, lvItem.pszText); + Utils::mucc_mir_free(lvItem.pszText); + +/* + ptr = new HelperContact(queryResult->pItems[i].pszID, queryResult->pItems[i].pszName); + if (lastptr !=NULL) { + lastptr->setNext(ptr); + } else { + contactList=ptr; + } + lastptr=ptr; + + */ + } + EnableWindow(GetDlgItem(getBrowserTabHWND(), IDC_SHOW), TRUE); +} + +const char *AdminWindow::getNick() { + return nick; +} + +int AdminWindow::getBrowserMode() { + return browserMode; +} diff --git a/!NotAdopted/Tlen/tlen_czaty/AdminWindow.h b/!NotAdopted/Tlen/tlen_czaty/AdminWindow.h new file mode 100644 index 0000000000..a73cdb9285 --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/AdminWindow.h @@ -0,0 +1,63 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +class AdminWindow; +#ifndef ADMINWINDOW_INCLUDED +#define ADMINWINDOW_INCLUDED + +#include "mucc.h" +#include "ChatWindow.h" + +class AdminWindow { +private: + HWND hWnd; + HWND hKickTabWnd, hBrowserTabWnd; + int currentTab; + int browserMode; + ChatWindow *parent; + char *nick; +public: + enum BROWSER_MODE { + BROWSE_BANNED = 1, + BROWSE_OWNERS = 2, + BROWSE_ADMINS = 3, + BROWSE_MEMBERS = 4, + BROWSE_MODERATORS = 5 + }; + AdminWindow (ChatWindow *parent, const char *nick, int mode); + ~AdminWindow(); + void start(); + void setHWND(HWND); + void setKickTabHWND(HWND); + void setBrowserTabHWND(HWND); + HWND getKickTabHWND(); + HWND getBrowserTabHWND(); + int getCurrentTab(); + int getBrowserMode(); + void setCurrentTab(int); + void queryUsers(int); + ChatWindow* getParent(); + const char *getNick(); + void queryResultUsers(MUCCQUERYRESULT *queryResult); +}; + +#endif + diff --git a/!NotAdopted/Tlen/tlen_czaty/ChatContainer.cpp b/!NotAdopted/Tlen/tlen_czaty/ChatContainer.cpp new file mode 100644 index 0000000000..11e523e337 --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/ChatContainer.cpp @@ -0,0 +1,480 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#include "ChatContainer.h" +#include "Utils.h" +#include "Options.h" + +#define DM_CREATECHILD (WM_USER+10) +#define DM_ADDCHILD (WM_USER+11) +#define DM_ACTIVATECHILD (WM_USER+12) +#define DM_CHANGECHILDDATA (WM_USER+13) +#define DM_REMOVECHILD (WM_USER+14) + +#define DM_SETUNREAD (WM_USER+15) +#define DM_FLASHWINDOW (WM_USER+16) + +#define TIMERID_FLASHWND 1 +#define TIMEOUT_FLASHWND 900 + +ChatContainer * ChatContainer::list = NULL; +bool ChatContainer::released = false; +CRITICAL_SECTION ChatContainer::mutex; + +//BOOL CALLBACK ContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); +static void __cdecl StartThread(void *vContainer); + +void ChatContainer::release() { + released = true; + for (ChatContainer *ptr2, *ptr = list; ptr!=NULL; ptr=ptr2) { + ptr2 = ptr->getNext(); + SendMessage(ptr->getHWND(), WM_CLOSE, 0, 0); + } + DeleteCriticalSection(&mutex); +} + +void ChatContainer::init() { + released = false; + InitializeCriticalSection(&mutex); +} + +int ChatContainer::getDefaultOptions() { + return FLAG_USE_TABS; +} + +ChatContainer * ChatContainer::getWindow() { + ChatContainer *ptr; + EnterCriticalSection(&mutex); + if (list == NULL || !(Options::getChatContainerOptions() & ChatContainer::FLAG_USE_TABS)) { + ptr = new ChatContainer(); + } else { + ptr = list; + } + LeaveCriticalSection(&mutex); + return ptr; +} + +ChatContainer::ChatContainer() { + hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + hWnd = NULL; + prev = next =NULL; + active = NULL; + childCount = 0; + nFlash = 0; + nFlashMax = 3; + Utils::forkThread((void (__cdecl *)(void *))StartThread, 0, (void *) this); + WaitForSingleObject(hEvent, INFINITE); + EnterCriticalSection(&mutex); + setNext(list); + if (next!=NULL) { + next->setPrev(this); + } + list = this; + LeaveCriticalSection(&mutex); +} + +ChatContainer::~ChatContainer() { + if (!released) { + EnterCriticalSection(&mutex); + if (getPrev()!=NULL) { + getPrev()->setNext(next); + } else if (list==this) { + list = getNext(); + } + if (getNext()!=NULL) { + getNext()->setPrev(prev); + } + LeaveCriticalSection(&mutex); + } + if (hEvent!=NULL) { + CloseHandle(hEvent); + } +} + +void ChatContainer::setHWND(HWND hWnd) { + this->hWnd = hWnd; +} + +HWND ChatContainer::getHWND() { + return hWnd; +} + +HANDLE ChatContainer::getEvent() { + return hEvent; +} + +ChatContainer * ChatContainer::getNext() { + return next; +} + +void ChatContainer::setNext(ChatContainer * next) { + this->next = next; +} + +ChatContainer * ChatContainer::getPrev() { + return prev; +} + +void ChatContainer::setPrev(ChatContainer * prev) { + this->prev = prev; +} + +void ChatContainer::show(bool bShow) { + ShowWindow(hWnd, bShow ? SW_SHOW : SW_HIDE); +} + +ChatWindow * ChatContainer::getActive() { + return active; +} + +int ChatContainer::getFlash() { + return nFlash; +} + +int ChatContainer::getFlashMax() { + return nFlashMax; +} + +int ChatContainer::getFlashTimeout() { + return TIMEOUT_FLASHWND; +} + +void ChatContainer::setFlash(int n) { + nFlash = n; +} + +void ChatContainer::activateChild(ChatWindow *window) { + RECT rcChild; + getChildWindowRect(&rcChild); + if (window!=NULL) { + SetWindowPos(window->getHWND(), HWND_TOP, rcChild.left, rcChild.top, rcChild.right-rcChild.left, rcChild.bottom - rcChild.top, SWP_NOSIZE); + } + if(window != active) { + ChatWindow *prev = active; + active = window; + SendMessage(hWnd, WM_SIZE, 0, 0); + ShowWindow(active->getHWND(), SW_SHOW); +// SendMessage(active->getHWND(), DM_UPDATETITLE, 0, 0); + if (prev!=NULL) { + ShowWindow(prev->getHWND(), SW_HIDE); + } + SetWindowTextA(hWnd, window->getRoomName()); + } + TCITEM tci; + tci.mask = TCIF_IMAGE; + tci.iImage = -1; + TabCtrl_SetItem(GetDlgItem(hWnd, IDC_TABS), getChildTab(window), &tci); + SendMessage(active->getHWND(), WM_ACTIVATE, WA_ACTIVE, 0); + SetFocus(active->getHWND()); +} + + +void ChatContainer::addChild(ChatWindow *child) { + TCITEM tci; + int tabId; + HWND hwndTabs = GetDlgItem(hWnd, IDC_TABS); + childCount++; + tci.mask = TCIF_TEXT | TCIF_PARAM; + LPTSTR lps1 = Utils::mucc_mir_a2t(child->getRoomName()); + tci.pszText = lps1; + tci.lParam = (LPARAM) child; + tabId = TabCtrl_InsertItem(hwndTabs, childCount-1, &tci); + TabCtrl_SetCurSel(hwndTabs, tabId); + Utils::mucc_mir_free(lps1); + activateChild(child); + SendMessage(hWnd, WM_SIZE, 0, 0); + ShowWindow(hWnd, SW_SHOWNORMAL); + SetForegroundWindow(hWnd); +} + +void ChatContainer::changeChildData(ChatWindow *child) { + int tabId; + HWND hwndTabs = GetDlgItem(hWnd, IDC_TABS); + tabId = getChildTab(child); + if (tabId >=0) { + TCITEM tci; + tci.mask = TCIF_TEXT; + LPTSTR lps1 = Utils::mucc_mir_a2t(child->getRoomName()); + tci.pszText = lps1; + TabCtrl_SetItem(hwndTabs, childCount-1, &tci); + Utils::mucc_mir_free(lps1); + } + if (child == active) { + SetWindowTextA(hWnd, child->getRoomName()); + } +} + + +void ChatContainer::removeChild(ChatWindow *child) { + HWND hwndTabs = GetDlgItem(hWnd, IDC_TABS); + int iSel = getChildTab(child); + if (iSel >= 0) { + TabCtrl_DeleteItem(hwndTabs, iSel); + } + childCount--; + if (childCount > 0) { + TCITEM tci; + if (iSel == childCount) iSel--; + TabCtrl_SetCurSel(hwndTabs, iSel); + tci.mask = TCIF_PARAM; + if (TabCtrl_GetItem(hwndTabs, iSel, &tci)) { + child = (ChatWindow *)tci.lParam; + activateChild(child); + } + } else {//if (!released) { + SendMessage(hWnd, WM_CLOSE, 0, 0); + } +} + +void ChatContainer::setUnread(ChatWindow *child, int unread) { + if (!unread || child != active) { + TCITEM tci; + tci.mask = TCIF_IMAGE; + if (unread) { + tci.iImage = 0; + } else { + tci.iImage = -1; + } + TabCtrl_SetItem(GetDlgItem(hWnd, IDC_TABS), getChildTab(child), &tci); + } +} + + +void ChatContainer::getChildWindowRect(RECT *rcChild) +{ + RECT rc, rcTabs; //rcStatus, + HWND hwndTabs = GetDlgItem(hWnd, IDC_TABS); + int l = TabCtrl_GetItemCount(hwndTabs); + GetClientRect(hWnd, &rc); + GetClientRect(hwndTabs, &rcTabs); + TabCtrl_AdjustRect(hwndTabs, FALSE, &rcTabs); +// GetWindowRect(dat->hwndStatus, &rcStatus); + rcChild->left = 0; + rcChild->right = rc.right; + if (l > 1) { + rcChild->top = rcTabs.top - 1; + } else { + rcChild->top = 0; + } + rcChild->bottom = rc.bottom - rc.top;// - (rcStatus.bottom - rcStatus.top); +} + +ChatWindow * ChatContainer::getChildFromTab(int tabId) { + TCITEM tci; + tci.mask = TCIF_PARAM; + TabCtrl_GetItem(GetDlgItem(hWnd, IDC_TABS), tabId, &tci); + return (ChatWindow *)tci.lParam; +} + +int ChatContainer::getChildTab(ChatWindow *child) { + TCITEM tci; + int l, i; + HWND hwndTabs = GetDlgItem(hWnd, IDC_TABS); + l = TabCtrl_GetItemCount(hwndTabs); + for (i = 0; i < l; i++) { + tci.mask = TCIF_PARAM; + TabCtrl_GetItem(hwndTabs, i, &tci); + if (child == (ChatWindow *) tci.lParam) { + return i; + } + } + return -1; + +} + +HWND ChatContainer::remoteCreateChild(DLGPROC proc, ChatWindow *ptr) { + return (HWND) SendMessage(hWnd, DM_CREATECHILD, (WPARAM)proc, (LPARAM) ptr); +} + +void ChatContainer::remoteAddChild(ChatWindow *ptr) { + SendMessage(hWnd, DM_ADDCHILD, (WPARAM)0, (LPARAM) ptr); +} + +void ChatContainer::remoteChangeChildData(ChatWindow *ptr) { + SendMessage(hWnd, DM_CHANGECHILDDATA, (WPARAM)0, (LPARAM) ptr); +} + +void ChatContainer::remoteRemoveChild(ChatWindow *ptr) { + SendMessage(hWnd, DM_REMOVECHILD, (WPARAM)0, (LPARAM) ptr); +} + +void ChatContainer::remoteSetUnread(ChatWindow *ptr, int unread) { + SendMessage(hWnd, DM_SETUNREAD, (WPARAM)unread, (LPARAM) ptr); +} + +void ChatContainer::remoteFlashWindow() { + SendMessage(hWnd, DM_FLASHWINDOW, 0, 0); +} + +INT_PTR CALLBACK ContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + ChatContainer *container; + container = (ChatContainer *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + if (container==NULL && msg!=WM_INITDIALOG) return FALSE; + switch (msg) { + case WM_INITDIALOG: + SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) muccIcon[MUCC_IDI_CHAT]); + container = (ChatContainer *) lParam; + container->setHWND(hwndDlg); + TabCtrl_SetImageList(GetDlgItem(hwndDlg, IDC_TABS), hImageList); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) container); + ShowWindow(hwndDlg, SW_SHOW); + SetEvent(container->getEvent()); + return TRUE; + case WM_GETMINMAXINFO: + MINMAXINFO *mmi; + RECT rcChild, rcWindow; + mmi = (MINMAXINFO *) lParam; + GetWindowRect(hwndDlg, &rcWindow); + container->getChildWindowRect(&rcChild); + mmi->ptMinTrackSize.x = 380; + mmi->ptMinTrackSize.y = 130 + (rcWindow.bottom - rcWindow.top) - (rcChild.bottom - rcChild.top); + return FALSE; + case WM_SIZE: + if (IsIconic(hwndDlg) || wParam == SIZE_MINIMIZED) break; + { + RECT rc, rcChild, rcWindow; + GetClientRect(hwndDlg, &rc); + HWND hwndTabs = GetDlgItem(hwndDlg, IDC_TABS); + MoveWindow(hwndTabs, 0, 0, (rc.right - rc.left), (rc.bottom - rc.top) - 0, FALSE); + RedrawWindow(hwndTabs, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_ERASE); + container->getChildWindowRect(&rcChild); + if ((rcChild.bottom-rcChild.top) < 130 || (rcChild.right-rcChild.left) < 380) { + GetWindowRect(hwndDlg, &rcWindow); + if ((rcChild.bottom-rcChild.top) < 130) { + rcWindow.bottom = rcWindow.top + 130 + (rcWindow.bottom - rcWindow.top) - (rcChild.bottom - rcChild.top); + } + if ((rcChild.right-rcChild.left) < 380) { + rcWindow.right = rcWindow.left + 380; + } + MoveWindow(hwndDlg, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, TRUE); + container->getChildWindowRect(&rcChild); + } + if (container->getActive()!=NULL) { + MoveWindow(container->getActive()->getHWND(), rcChild.left, rcChild.top, rcChild.right-rcChild.left, rcChild.bottom - rcChild.top, TRUE); + } + } + return TRUE; + case DM_CREATECHILD: + SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_GROUPCHAT_LOG), hwndDlg, (DLGPROC) wParam, (LPARAM) lParam)); + return TRUE; + case DM_ADDCHILD: + container->addChild((ChatWindow *) lParam); + return TRUE; + case DM_REMOVECHILD: + container->removeChild((ChatWindow *) lParam); + return TRUE; + case DM_CHANGECHILDDATA: + container->removeChild((ChatWindow *) lParam); + return TRUE; + case DM_SETUNREAD: + container->setUnread((ChatWindow *) lParam, (int)wParam); + return TRUE; + case DM_FLASHWINDOW: + if (GetActiveWindow() != hwndDlg && GetForegroundWindow() != hwndDlg) { + container->setFlash(0); + SetTimer(hwndDlg, TIMERID_FLASHWND, container->getFlashTimeout(), NULL); + } + return TRUE; + case WM_NOTIFY: + { + NMHDR* pNMHDR = (NMHDR*) lParam; + switch (pNMHDR->code) { + case TCN_SELCHANGE: + { + TCITEM tci = {0}; + HWND hwndTabs = GetDlgItem(hwndDlg, IDC_TABS); + int iSel = TabCtrl_GetCurSel(hwndTabs); + tci.mask = TCIF_PARAM; + if (TabCtrl_GetItem(hwndTabs, iSel, &tci)) { + ChatWindow * chatWindow = (ChatWindow *) tci.lParam; + container->activateChild(chatWindow); + } + } + break; + case NM_CLICK: + { + FILETIME ft; + TCHITTESTINFO thinfo; + int tabId; + HWND hwndTabs = GetDlgItem(hwndDlg, IDC_TABS); + GetSystemTimeAsFileTime(&ft); + GetCursorPos(&thinfo.pt); + ScreenToClient(hwndTabs, &thinfo.pt); + tabId = TabCtrl_HitTest(hwndTabs, &thinfo); + if (tabId != -1 && tabId == container->lastClickTab && + (ft.dwLowDateTime - container->lastClickTime) < (GetDoubleClickTime() * 10000)) { + SendMessage(container->getChildFromTab(tabId)->getHWND(), WM_CLOSE, 0, 0); + container->lastClickTab = -1; + } else { + container->lastClickTab = tabId; + } + container->lastClickTime = ft.dwLowDateTime; + } + break; + } + + } + break; + case WM_ACTIVATE: + if (LOWORD(wParam) != WA_ACTIVE) + break; + case WM_MOUSEACTIVATE: + if (KillTimer(hwndDlg, TIMERID_FLASHWND)) { + FlashWindow(hwndDlg, FALSE); + } + /* + if (container->getActive()!=NULL) { + container->setUnread(container->getActive(), 0); + SendMessage(container->getActive()->getHWND(), WM_ACTIVATE, WA_ACTIVE, 0); + }*/ + break; + case WM_CLOSE: + EndDialog(hwndDlg, 0); + return FALSE; + case WM_TIMER: + if (wParam == TIMERID_FLASHWND) { + if ((container->getFlash() > container->getFlashMax()) || (GetActiveWindow() == hwndDlg) || (GetForegroundWindow() == hwndDlg)) { + KillTimer(hwndDlg, TIMERID_FLASHWND); + FlashWindow(hwndDlg, FALSE); + } else if (container->getFlash() < container->getFlashMax()) { + FlashWindow(hwndDlg, TRUE); + container->setFlash(container->getFlash()+1); + } + } + break; + case WM_DESTROY: + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)0); + delete container; + return TRUE; + + } + return FALSE; +} + + +static void __cdecl StartThread(void *vContainer) { + OleInitialize(NULL); + DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_GROUPCHAT_CONTAINER), NULL, ContainerDlgProc, (LPARAM) vContainer); + //MessageBox(NULL, "ChatContainer dies.", "MW", MB_OK); + OleUninitialize(); + +} diff --git a/!NotAdopted/Tlen/tlen_czaty/ChatContainer.h b/!NotAdopted/Tlen/tlen_czaty/ChatContainer.h new file mode 100644 index 0000000000..4414068033 --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/ChatContainer.h @@ -0,0 +1,100 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +class ChatContainer; + +#ifndef CHATCONTAINER_INCLUDED +#define CHATCONTAINER_INCLUDED +#include "mucc.h" +#include "ChatEvent.h" +#include "ChatUser.h" +#include "AdminWindow.h" + +class ChatContainerChild { +public: + ChatWindow *window; + ChatContainerChild *next; + ChatContainerChild *prev; +}; + +class ChatContainer{ + +private: + static ChatContainer * list; + static bool released; + static CRITICAL_SECTION mutex; + HWND hWnd; + HANDLE hEvent; + int childCount; + int width, height; + int nFlash, nFlashMax; + ChatContainer *next, *prev; + ChatWindow * active; + ChatContainer(); +protected: + friend INT_PTR CALLBACK ContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); + void addChild(ChatWindow *); + void activateChild(ChatWindow *); + void changeChildData(ChatWindow *); + void removeChild(ChatWindow *); + void setUnread(ChatWindow *child, int unread); + void getChildWindowRect(RECT *rcChild); + ChatWindow * getChildFromTab(int tabId); + int getChildTab(ChatWindow *); + int getChildCount(); + void setChildCount(int); + ChatWindow * getActive(); + ChatContainerChild *getChildren(); + ChatContainer * getNext(); + void setNext(ChatContainer *); + ChatContainer * getPrev(); + void setPrev(ChatContainer *); + int lastClickTime; + int lastClickTab; + HANDLE getEvent(); + void setHWND(HWND); + int getFlash(); + int getFlashMax(); + int getFlashTimeout(); + void setFlash(int); +public: + enum FLAGS { + FLAG_USE_TABS = 0x00000001, + }; + + ~ChatContainer(); + static void init(); + static void release(); + static ChatContainer * getWindow(); + static int getDefaultOptions(); + void show(bool bShow); + HWND getHWND(); + + HWND remoteCreateChild(DLGPROC proc, ChatWindow *); + void remoteAddChild(ChatWindow *); + void remoteChangeChildData(ChatWindow *); + void remoteRemoveChild(ChatWindow *); + void remoteSetUnread(ChatWindow *ptr, int unread); + void remoteFlashWindow(); +}; + + +#endif diff --git a/!NotAdopted/Tlen/tlen_czaty/ChatEvent.cpp b/!NotAdopted/Tlen/tlen_czaty/ChatEvent.cpp new file mode 100644 index 0000000000..246c168f22 --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/ChatEvent.cpp @@ -0,0 +1,174 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#include "ChatEvent.h" +#include "Options.h" +#include "Utils.h" +#include + +ChatEvent::ChatEvent() { + + next = prev = NULL; + event.cbSize = sizeof(MUCCEVENT); + event.iType = 0; + event.pszID = NULL; + event.pszModule = NULL; + event.pszName = NULL; + event.pszNick = NULL; + event.pszText = NULL; + event.pszUID = NULL; +} + +ChatEvent::ChatEvent(const MUCCEVENT *e) { + + event.cbSize = sizeof(MUCCEVENT); + event.iType = e->iType; + event.bIsMe = e->bIsMe; + event.color = e->color; + event.dwData = e->dwData; + event.dwFlags = e->dwFlags; + event.iFont = e->iFont; + event.iFontSize = e->iFontSize; + event.time = e->time; + event.pszID = NULL; + event.pszModule = NULL; + event.pszName = NULL; + event.pszNick = NULL; + event.pszText = NULL; + event.pszUID = NULL; +// Utils::copyString((char **)&(event.pszID), e->pszID); +// Utils::copyString((char **)&(event.pszModule), e->pszModule); +// Utils::copyString((char **)&(event.pszName), e->pszName); + if (e->iType == MUCC_EVENT_STATUS || e->iType == MUCC_EVENT_MESSAGE) { + Utils::copyString((char **)&(event.pszNick), e->pszNick); + } + if (e->iType == MUCC_EVENT_ERROR || e->iType == MUCC_EVENT_MESSAGE || e->iType == MUCC_EVENT_TOPIC) { + Utils::copyString((char **)&(event.pszText), e->pszText); + } +// Utils::copyString((char **)&(event.pszUID), e->pszUID); + next = prev = NULL; +} + +ChatEvent::~ChatEvent() { + + if (event.pszID != NULL) { + delete (char *)event.pszID; + } + if (event.pszModule != NULL) { + delete (char *)event.pszModule; + } + if (event.pszName != NULL) { + delete (char *)event.pszName; + } + if (event.pszNick != NULL) { + delete (char *)event.pszNick; + } + if (event.pszText != NULL) { + delete (char *)event.pszText; + } + if (event.pszUID != NULL) { + delete (char *)event.pszUID; + } + if (next != NULL) { + next->setPrev(prev); + } + if (prev != NULL) { + prev->setNext(next); + } +} + +ChatEvent * ChatEvent::getNext() { + return next; +} + +ChatEvent * ChatEvent::getPrev() { + return prev; +} + +void ChatEvent::setNext(ChatEvent *next) { + this->next = next; +} + +void ChatEvent::setPrev(ChatEvent * prev) { + this->prev = prev; +} + +const MUCCEVENT * ChatEvent::getEvent() { + return &event; +} + +ChatEventList::ChatEventList() { + eventListEnd = &eventListRoot; + setMaxSize(DEFAULT_MAX_SIZE); + currentSize = 0; +} + +ChatEventList::~ChatEventList() { + while (eventListRoot.getNext()!=NULL) { + delete eventListRoot.getNext(); + } +} + +int ChatEventList::addEvent(const MUCCEVENT *muccevent) { + int trimmed = 0; + ChatEvent *event = new ChatEvent(muccevent); + event->setPrev(eventListEnd); + eventListEnd->setNext(event); + eventListEnd=event; + currentSize++; + if (currentSize>hiMaxSize) { + while (currentSize>loMaxSize && eventListRoot.getNext()!=NULL) { + delete eventListRoot.getNext(); + currentSize--; + trimmed = 1; + } + } + return trimmed; +} + +ChatEvent * ChatEventList::getEvents() { + return eventListRoot.getNext(); +} + +void ChatEventList::setMaxSize(int s) { + loMaxSize = s; + if (s>200) { + hiMaxSize = s + s/10; + } else { + hiMaxSize = s + 20; + } +} + +void ChatEventList::clear() { + ChatEvent *event = eventListRoot.getNext(); + eventListRoot.setNext(NULL); + eventListEnd = &eventListRoot; + currentSize = 0; + if (event!=NULL) { + event->setPrev(NULL); + while (event->getNext()!=NULL) { + delete event->getNext(); + } + delete event; + } +} + + diff --git a/!NotAdopted/Tlen/tlen_czaty/ChatEvent.h b/!NotAdopted/Tlen/tlen_czaty/ChatEvent.h new file mode 100644 index 0000000000..37e045380f --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/ChatEvent.h @@ -0,0 +1,60 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +#ifndef CHATEVENT_INCLUDED +#define CHATEVENT_INCLUDED +#include "mucc.h" + +class ChatEvent { +private: + ChatEvent * prev; + ChatEvent * next; + MUCCEVENT event; +public: + ChatEvent(); + ChatEvent(const MUCCEVENT *); + ~ChatEvent(); + ChatEvent * getPrev(); + ChatEvent * getNext(); + void setPrev(ChatEvent *); + void setNext(ChatEvent *); + const MUCCEVENT *getEvent(); +}; + +class ChatEventList { +private: + ChatEvent eventListRoot; + ChatEvent * eventListEnd; + int loMaxSize; + int hiMaxSize; + int currentSize; +public: + enum { + DEFAULT_MAX_SIZE = 100 + }; + ChatEventList(); + ~ChatEventList(); + ChatEvent * getEvents(); + int addEvent(const MUCCEVENT *); + void clear(); + void setMaxSize(int s); +}; + +#endif diff --git a/!NotAdopted/Tlen/tlen_czaty/ChatGroup.cpp b/!NotAdopted/Tlen/tlen_czaty/ChatGroup.cpp new file mode 100644 index 0000000000..a5c47d724f --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/ChatGroup.cpp @@ -0,0 +1,99 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#include "ChatGroup.h" +#include "Utils.h" + +ChatGroup::ChatGroup() { + prev = next = NULL; + parent = child =NULL; + name = NULL; + id = 0; +} + +ChatGroup::~ChatGroup() { + if (name!=NULL) delete name; + if (id!=NULL) delete id; +} +ChatGroup * ChatGroup::getNext() { + return next; +} + +void ChatGroup::setNext(ChatGroup *next) { + this->next = next; +} + +ChatGroup * ChatGroup::getPrev() { + return prev; +} + +void ChatGroup::setPrev(ChatGroup *prev) { + this->prev = prev; +} + +ChatGroup * ChatGroup::getChild() { + return child; +} + +void ChatGroup::addChild(ChatGroup *child) { + ChatGroup *group; + for (group=getChild();group!=NULL && group->getNext()!=NULL;group=group->getNext()) { + } + if (group==NULL) this->child = child; + else { + group->setNext(child); + } + child->setPrev(group); + child->setNext(NULL); +} + +ChatGroup * ChatGroup::getListNext() { + return listNext; +} + +void ChatGroup::setListNext(ChatGroup *next) { + this->listNext = next; +} + +const char *ChatGroup::getId() { + return id; +} + +void ChatGroup::setId(const char *id) { + Utils::copyString(&this->id, id); +} + +HTREEITEM ChatGroup::getTreeItem() { + return hItem; +} + +void ChatGroup::setTreeItem(HTREEITEM hItem) { + this->hItem=hItem; +} + +const char *ChatGroup::getName() { + return name; +} + +void ChatGroup::setName(const char *name) { + Utils::copyString(&this->name, name); +} + diff --git a/!NotAdopted/Tlen/tlen_czaty/ChatGroup.h b/!NotAdopted/Tlen/tlen_czaty/ChatGroup.h new file mode 100644 index 0000000000..c04abf81ba --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/ChatGroup.h @@ -0,0 +1,55 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +#ifndef CHATGROUP_INCLUDED +#define CHATGROUP_INCLUDED +#include "mucc.h" + +class ChatGroup { +private: + HTREEITEM hItem; + ChatGroup * parent; + ChatGroup * child; + ChatGroup * prev; + ChatGroup * next; + ChatGroup * listNext; + char * name; + char * id; +public: + ChatGroup(); + ~ChatGroup(); + ChatGroup * getPrev(); + ChatGroup * getNext(); + ChatGroup * getListNext(); + ChatGroup * getChild(); + ChatGroup * getParent(); + HTREEITEM getTreeItem(); + const char * getName(); + const char * getId(); + void setPrev(ChatGroup *); + void setNext(ChatGroup *); + void setListNext(ChatGroup *); + void addChild(ChatGroup *); + void setParent(ChatGroup *); + void setName(const char *); + void setTreeItem(HTREEITEM ); + void setId(const char *); +}; +#endif diff --git a/!NotAdopted/Tlen/tlen_czaty/ChatRoom.cpp b/!NotAdopted/Tlen/tlen_czaty/ChatRoom.cpp new file mode 100644 index 0000000000..2f9c1389c2 --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/ChatRoom.cpp @@ -0,0 +1,68 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#include "ChatRoom.h" +#include "Utils.h" + + +ChatRoom::ChatRoom() { + next = prev = NULL; + name = NULL; + id = NULL; +} + +ChatRoom::~ChatRoom() { + if (name!=NULL) delete name; + if (id!=NULL) delete id; +} + +void ChatRoom::setId(const char *id) { + Utils::copyString(&this->id, id); +} + +void ChatRoom::setName(const char *name) { + Utils::copyString(&this->name, name); +} + +const char* ChatRoom::getId() { + return id; +} + +const char* ChatRoom::getName() { + return name; +} + +ChatRoom *ChatRoom::getNext() { + return next; +} + +void ChatRoom::setNext(ChatRoom *next) { + this->next = next; +} + +void ChatRoom::setFlags(int flags) { + this->flags = flags; +} + +int ChatRoom::getFlags() { + return flags; +} + diff --git a/!NotAdopted/Tlen/tlen_czaty/ChatRoom.h b/!NotAdopted/Tlen/tlen_czaty/ChatRoom.h new file mode 100644 index 0000000000..51593f00c2 --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/ChatRoom.h @@ -0,0 +1,51 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +#ifndef CHATROOM_INCLUDED +#define CHATROOM_INCLUDED +#include "mucc.h" + + +class ChatRoom { +private: + HTREEITEM hItem; + ChatRoom * prev; + ChatRoom * next; + char * name; + char * id; + int flags; +public: + ChatRoom(); + ~ChatRoom(); + ChatRoom * getPrev(); + ChatRoom * getNext(); + HTREEITEM getTreeItem(); + const char * getName(); + const char * getId(); + int getFlags(); + void setPrev(ChatRoom *); + void setNext(ChatRoom *); + void setName(const char *); + void setTreeItem(HTREEITEM ); + void setId(const char *); + void setFlags(int); +}; + +#endif diff --git a/!NotAdopted/Tlen/tlen_czaty/ChatUser.cpp b/!NotAdopted/Tlen/tlen_czaty/ChatUser.cpp new file mode 100644 index 0000000000..cb5baea1a8 --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/ChatUser.cpp @@ -0,0 +1,83 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#include "ChatUser.h" +#include "Utils.h" + +ChatUser::ChatUser() { + id = NULL; + nick = NULL; + hTreeItem = NULL; + me = 0; +} + +ChatUser::~ChatUser() { + if (id!=NULL) delete id; + if (nick!=NULL) delete nick; +} + +void ChatUser::setNick(const char *nick) { + Utils::copyString(&this->nick, nick); +} + +void ChatUser::setId(const char *id) { + Utils::copyString(&this->id, id); +} + +const char *ChatUser::getNick() { + return nick; +} + +const char *ChatUser::getId() { + return id; +} + +void ChatUser::setNext(ChatUser *next) { + this->next = next; +} + +ChatUser * ChatUser::getNext() { + return next; +} + +void ChatUser::setFlags(int flags) { + this->flags = flags; +} + +int ChatUser::getFlags() { + return flags; +} + +void ChatUser::setMe(int me) { + this->me = me; +} + +int ChatUser::isMe() { + return me; +} + +void ChatUser::setHTreeItem(HTREEITEM hti) { + hTreeItem = hti; +} + +HTREEITEM ChatUser::getHTreeItem() { + return hTreeItem; +} diff --git a/!NotAdopted/Tlen/tlen_czaty/ChatUser.h b/!NotAdopted/Tlen/tlen_czaty/ChatUser.h new file mode 100644 index 0000000000..0084a14608 --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/ChatUser.h @@ -0,0 +1,49 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +#ifndef CHATUSER_INCLUDED +#define CHATUSER_INCLUDED +#include "mucc.h" + +class ChatUser { +private: + char * nick; + char * id; + int flags; + int me; + ChatUser * next; + HTREEITEM hTreeItem; +public: + ChatUser(); + ~ChatUser(); + void setNick(const char *); + void setId(const char *); + const char * getNick(); + const char * getId(); + void setNext(ChatUser *); + int getFlags(); + void setFlags(int ); + HTREEITEM getHTreeItem(); + void setHTreeItem(HTREEITEM); + ChatUser * getNext(); + void setMe(int); + int isMe(); +}; +#endif diff --git a/!NotAdopted/Tlen/tlen_czaty/ChatWindow.cpp b/!NotAdopted/Tlen/tlen_czaty/ChatWindow.cpp new file mode 100644 index 0000000000..97dc986381 --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/ChatWindow.cpp @@ -0,0 +1,2108 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#include "ChatWindow.h" +#include "HelperDialog.h" +#include "Utils.h" +#include "Options.h" +#include "m_smileyadd.h" +#include "m_ieview.h" +//#include "m_chat.h" + +static int logPixelSY; +static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); +static void JabberStringAppend(char **str, int *sizeAlloced, const char *fmt, ...); +static char *JabberRtfEscape(char *str); +//static DWORD CALLBACK Log_StreamCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb); + +COLORREF ChatWindow::colorListBg, ChatWindow::colorListText, ChatWindow::colorListGroupText; +HFONT ChatWindow::hListGroupFont=NULL; +HFONT ChatWindow::hListFont=NULL; + +ChatWindow * ChatWindow::list = NULL; +bool ChatWindow::released = false; +CRITICAL_SECTION ChatWindow::mutex; + +static WNDPROC oldSplitterWndProc, oldEditWndProc; +static HCURSOR hCurSplitNS, hCurSplitWE, hCurHyperlinkHand; + +void ChatWindow::release() { + released = true; + for (ChatWindow *ptr2, *ptr = list; ptr!=NULL; ptr=ptr2) { + ptr2 = ptr->getNext(); + //SendMessage(ptr->getHWND(), WM_CLOSE, 0, 0); + } + DeleteCriticalSection(&mutex); + DestroyCursor(hCurSplitNS); + DestroyCursor(hCurSplitWE); + DestroyCursor(hCurHyperlinkHand); +} + +void ChatWindow::init() { + hCurSplitNS = LoadCursor(NULL, IDC_SIZENS); + hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE); + hCurHyperlinkHand = LoadCursor(NULL, IDC_HAND); + if (hCurHyperlinkHand == NULL) { + hCurHyperlinkHand = LoadCursor(NULL, IDC_ARROW); + } + released = false; + InitializeCriticalSection(&mutex); +} + +/* chat.dll mod*/ +/* +static bool gcRegistered = false; + +static void __stdcall StartThread(void *vChat) { //__cdecl + ChatWindow *chat = (ChatWindow *)vChat; + if (!gcRegistered) { + gcRegistered = true; + GCREGISTER gcr = {0}; + gcr.cbSize = sizeof(GCREGISTER); + gcr.dwFlags = 0; + gcr.iMaxText = 0; + gcr.nColors = 0; + gcr.pColors = 0; + gcr.pszModuleDispName = chat->getModule(); + gcr.pszModule = chat->getModule(); + if (CallService(MS_GC_REGISTER, 0, (LPARAM)&gcr)) { + MessageBox(NULL, "cannot register", "CHAT", MB_OK); + } + } + GCWINDOW gcw = {0}; + gcw.cbSize = sizeof(GCWINDOW); + gcw.iType = GCW_CHATROOM; + gcw.pszModule = chat->getModule(); + gcw.pszName = chat->getRoomName(); + gcw.pszID = chat->getRoomId(); + gcw.pszStatusbarText = "status"; + gcw.bDisableNickList = FALSE; + gcw.dwItemData = (DWORD) chat; + if(CallService(MS_GC_NEWCHAT, 0, (LPARAM) &gcw)) { + MessageBox(NULL, "cannot create", "CHAT", MB_OK); + } + + GCDEST gcdest; + GCEVENT gcevent = {sizeof(GCEVENT), &gcdest}; + const char *groupNames[] = {"Global Owners", "Owners", "Admins", "Moderators", "Users"}; + gcdest.pszModule = (char *)chat->getModule(); + gcdest.pszID = (char *)chat->getRoomId(); + gcevent.bAddToLog = FALSE; + gcevent.time = 0; + gcdest.iType = GC_EVENT_ADDGROUP; + for (int i=0;i<5;i++) { + gcevent.pszStatus = Translate(groupNames[i]); + CallService(MS_GC_EVENT, 0, (LPARAM)&gcevent); + } + + + gcdest.iType = GC_EVENT_CONTROL; + CallService(MS_GC_EVENT, WINDOW_INITDONE, (LPARAM)&gcevent); + CallService(MS_GC_EVENT, WINDOW_ONLINE, (LPARAM)&gcevent); +} +*/ + +ChatWindow::ChatWindow(MUCCWINDOW *mucw) { + prev = next = NULL; + adminWindow = NULL; + hWnd = NULL; + hWndLog = NULL; + module = roomId = roomName = topic = NULL; + hSplitterPos = 0; + vSplitterPos = 0; + wasFirstMessage = 0; + isEmpty = true; + isStarted = 0; + options = Options::getChatWindowOptions(); + bBold = bItalic = bUnderline = 0; + hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + hEditFont = NULL; + userMe = NULL; + users = NULL; + for (int i=0;i<5;i++) { + hUserGroups[i] = NULL; + } + setModule(mucw->pszModule); + setRoomId(mucw->pszID); + setRoomName(mucw->pszName); + EnterCriticalSection(&mutex); + setNext(list); + if (next!=NULL) { + next->setPrev(this); + } + list = this; + LeaveCriticalSection(&mutex); + container = ChatContainer::getWindow(); + hWnd = container->remoteCreateChild(LogDlgProc, this); + container->remoteAddChild(this); + /* chat.dll mod*/ +/* CallFunctionAsync(StartThread, (void *)this);*/ +} + +ChatWindow::~ChatWindow () { + if (!released) { + EnterCriticalSection(&mutex); + if (getPrev()!=NULL) { + getPrev()->setNext(next); + } else if (list==this) { + list = getNext(); + } + if (getNext()!=NULL) { + getNext()->setPrev(prev); + } + LeaveCriticalSection(&mutex); + } + if (adminWindow!=NULL) { + delete adminWindow; + } + if (hEvent!=NULL) { + CloseHandle(hEvent); + } + while (users!=NULL) { + ChatUser *user = users; + users = users->getNext(); + delete user; + } + if (module!=NULL) { + delete module; + } + if (roomId!=NULL) { + delete roomId; + } + if (roomName!=NULL) { + delete roomName; + } + if (topic!=NULL) { + delete topic; + } + container->remoteRemoveChild(this); +}; + + +void ChatWindow::setPrev(ChatWindow *prev) { + this->prev = prev; +} + +ChatWindow * ChatWindow::getPrev() { + return prev; +} + +void ChatWindow::setNext(ChatWindow *next) { + this->next = next; +} + +ChatWindow * ChatWindow::getNext() { + return next; +} + +void ChatWindow::setHWND(HWND hWnd) { + this->hWnd = hWnd; +} + +HWND ChatWindow::getHWND() { + return hWnd; +} + +void ChatWindow::setHWNDLog(HWND hWnd) { + this->hWndLog = hWnd; +} + +HWND ChatWindow::getHWNDLog() { + return hWndLog; +} + +HANDLE ChatWindow::getEvent() { + return hEvent; +} + +ChatContainer * ChatWindow::getContainer() { + return container; +} + +void ChatWindow::setAdminWindow(AdminWindow *aw) { + this->adminWindow = aw; +} + +AdminWindow* ChatWindow::getAdminWindow() { + return adminWindow; +} + +void ChatWindow::setModule(const char *module) { + Utils::copyString(&this->module, module); +} + +const char * ChatWindow::getModule() { + return module; +} + +void ChatWindow::setRoomId(const char *roomId) { + Utils::copyString(&this->roomId, roomId); +} + +const char * ChatWindow::getRoomId() { + return roomId; +} + +void ChatWindow::setRoomName(const char *roomName) { +// char str[300]; + Utils::copyString(&this->roomName, roomName); +// sprintf(str, "%s %08X", roomName, roomFlags); +// SetWindowText(hWnd, str); + SetWindowTextA(hWnd, roomName); +} + +void ChatWindow::setRoomFlags(int flags) { +// char str[300]; + roomFlags = flags; +// sprintf(str, "%s %08X", roomName, roomFlags); +// SetWindowText(hWnd, str); +} + +int ChatWindow::getRoomFlags() { + return roomFlags; +} + +const char * ChatWindow::getRoomName() { + return roomName; +} + +void ChatWindow::setOptions(int options) { + if (options != this->options) { + this->options = options; + rebuildLog(); + } +} + +int ChatWindow::getOptions() { + return options; +} + +static void __cdecl StartAdminThread(void *vChat) { + ChatWindow *chat = (ChatWindow *)vChat; + chat->getAdminWindow()->start(); +} + +void ChatWindow::startAdminDialog(int mode) { + if (adminWindow==NULL) { + ChatUser *user = getSelectedUser(); + if (user != NULL) { + adminWindow = new AdminWindow(this, user->getId(), mode); + } else { + adminWindow = new AdminWindow(this, "", mode); + } + Utils::forkThread((void (__cdecl *)(void *))StartAdminThread, 0, (void *) this); + } +} +void ChatWindow::addUser(ChatUser *user) { + user->setNext(users); + users = user; +} +void ChatWindow::removeUser(ChatUser *user) { + ChatUser *user2; + for (user2=users;user2!=NULL;user2=user2->getNext()) { + if (user2->getNext()==user) break; + } + if (user2!=NULL) { + user2->setNext(user->getNext()); + } else if (users==user) { + users = user->getNext(); + } +} + +ChatUser * ChatWindow::getMe() { + return userMe; +} + +ChatUser * ChatWindow::findUser(const char *userId) { + ChatUser *user; + for (user=users;user!=NULL;user=user->getNext()) { + if (!(strcmp(user->getId(), userId))) break; + } + return user; +} + +ChatUser * ChatWindow::findUserByNick(const char *nick) { + ChatUser *user; + for (user=users;user!=NULL;user=user->getNext()) { + if (!(strcmp(user->getNick(), nick))) break; + } + return user; +} + +ChatUser *ChatWindow::getSelectedUser() { + HTREEITEM hTreeItem = TreeView_GetSelection(GetDlgItem(hWnd, IDC_TREELIST)); + if (hTreeItem!=NULL) { + TVITEM tvi; + tvi.mask = TVIF_PARAM; + tvi.hItem = hTreeItem; + TreeView_GetItem(GetDlgItem(hWnd, IDC_TREELIST), &tvi); + return (ChatUser *) tvi.lParam; + } + return NULL; +} + +int ChatWindow::startPriv() { + ChatUser *user = getSelectedUser(); + if (user!=NULL) { + MUCCEVENT mucce; + mucce.cbSize = sizeof(MUCCEVENT); + mucce.iType = MUCC_EVENT_START_PRIV; + mucce.pszModule = getModule(); + mucce.pszID = getRoomId(); + mucce.pszUID = user->getId(); + NotifyEventHooks(hHookEvent, 0,(WPARAM)&mucce); + } + return 0; +} + +int ChatWindow::unban(const char *id) { + if (id!=NULL) { + MUCCEVENT mucce; + mucce.cbSize = sizeof(MUCCEVENT); + mucce.iType = MUCC_EVENT_UNBAN; + mucce.pszModule = getModule(); + mucce.pszID = getRoomId(); + mucce.pszUID = id; + NotifyEventHooks(hHookEvent, 0,(WPARAM)&mucce); + } + return 0; +} + + +int ChatWindow::kickAndBan(const char *id, int time, const char *reason) { + if (id!=NULL) { + MUCCEVENT mucce; + mucce.cbSize = sizeof(MUCCEVENT); + mucce.iType = MUCC_EVENT_KICK_BAN; + mucce.pszModule = getModule(); + mucce.pszID = getRoomId(); + mucce.pszUID = id; + mucce.dwData = time; + mucce.pszText = reason; + NotifyEventHooks(hHookEvent, 0,(WPARAM)&mucce); + } + return 0; +} + +int ChatWindow::kickAndBan(int time) { + ChatUser *user = getSelectedUser(); + if (user!=NULL) { + kickAndBan(user->getId(), time, ""); + } + return 0; +} + +int ChatWindow::setRights(const char *id, int flags) { + if (id!=NULL) { + MUCCEVENT mucce; + mucce.cbSize = sizeof(MUCCEVENT); + mucce.iType = MUCC_EVENT_SET_USER_ROLE; + mucce.pszModule = getModule(); + mucce.pszID = getRoomId(); + mucce.pszUID = id; + mucce.dwFlags = flags; + NotifyEventHooks(hHookEvent, 0,(WPARAM)&mucce); + } + return 0; +} + +int ChatWindow::setRights(int flags) { + ChatUser *user = getSelectedUser(); + if (user!=NULL) { + setRights(user->getId(), flags); + } + return 0; +} + +int ChatWindow::getUserGroup(ChatUser *user) { + int group = 4; + if (user->getFlags()&MUCC_EF_USER_GLOBALOWNER) { + group = 0; + } else if (user->getFlags()&MUCC_EF_USER_OWNER) { + group = 1; + } else if (user->getFlags()&MUCC_EF_USER_ADMIN) { + group = 2; + } else if (user->getFlags()&MUCC_EF_USER_MODERATOR) { + group = 3; + } + return group; +} + +int ChatWindow::changePresence(const MUCCEVENT *event) { + int i, group, bLogEvent = FALSE; + const char *groupNames[] = {"Global Owners", "Owners", "Admins", "Moderators", "Users"}; + ChatUser *user = findUser(event->pszUID); + if (event->dwData == ID_STATUS_ONLINE || (user!=NULL && event->dwData!=ID_STATUS_OFFLINE)) { + if (user == NULL) { + user = new ChatUser(); + user->setId(event->pszUID); + user->setNick(event->pszNick); + user->setFlags(event->dwFlags); + user->setMe(event->bIsMe); + addUser(user); + if (user->isMe()) { + userMe = user; + } + bLogEvent = TRUE; + } else { + group = getUserGroup(user); + user->setFlags(event->dwFlags); + TreeView_DeleteItem(GetDlgItem(hWnd, IDC_TREELIST), user->getHTreeItem()); + if (TreeView_GetChild(GetDlgItem(hWnd, IDC_TREELIST), getTreeItem(group))==NULL) { + TreeView_DeleteItem(GetDlgItem(hWnd, IDC_TREELIST), getTreeItem(group)); + setTreeItem(group, NULL); + } + } + if (user->isMe()) { + if (user->getFlags() & MUCC_EF_USER_OWNER || user->getFlags() & MUCC_EF_USER_ADMIN) { + EnableWindow(GetDlgItem(hWnd, IDC_TOPIC_BUTTON), TRUE); + } else { + EnableWindow(GetDlgItem(hWnd, IDC_TOPIC_BUTTON), FALSE); + } + } + group = getUserGroup(user); + TVINSERTSTRUCT tvis; + if (getTreeItem(group)==NULL) { + for (i=group-1;i>=0;i--) { + if (getTreeItem(i)!=NULL) break; + } + tvis.hParent = NULL; + if (i>=0) { + tvis.hInsertAfter = getTreeItem(i); + } else { + tvis.hInsertAfter = TVI_FIRST; + } + tvis.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_CHILDREN; + tvis.item.lParam = (LPARAM) NULL; + tvis.item.cChildren = 1; + LPTSTR lps1 = Utils::mucc_mir_a2t(Translate(groupNames[group])); + tvis.item.pszText = lps1; + //tvis.item.state = INDEXTOSTATEIMAGEMASK(1); + //tvis.item.stateMask = TVIS_STATEIMAGEMASK ; + setTreeItem(group, TreeView_InsertItem(GetDlgItem(hWnd, IDC_TREELIST), &tvis)); + Utils::mucc_mir_free(lps1); + } + tvis.hParent = getTreeItem(group); + tvis.hInsertAfter = TVI_SORT; + tvis.item.mask = TVIF_TEXT | TVIF_PARAM; + LPTSTR lps2 = Utils::mucc_mir_a2t(user->getNick()); + tvis.item.pszText = lps2; + tvis.item.lParam = (LPARAM) user; + user->setHTreeItem(TreeView_InsertItem(GetDlgItem(hWnd, IDC_TREELIST), &tvis)); + TreeView_Expand(GetDlgItem(hWnd, IDC_TREELIST), getTreeItem(group), TVE_EXPAND); + Utils::mucc_mir_free(lps2); + } + else { + if (user != NULL) { + group = getUserGroup(user); + TreeView_DeleteItem(GetDlgItem(hWnd, IDC_TREELIST), user->getHTreeItem()); + if (TreeView_GetChild(GetDlgItem(hWnd, IDC_TREELIST), getTreeItem(group))==NULL) { + TreeView_DeleteItem(GetDlgItem(hWnd, IDC_TREELIST), getTreeItem(group)); + setTreeItem(group, NULL); + } + removeUser(user); + delete user; + bLogEvent = TRUE; + } + } + if (bLogEvent && wasFirstMessage) { + logEvent(event); + } + return 1; +} +int ChatWindow::changeTopic(const MUCCEVENT *event) { + + SetDlgItemTextA(hWnd, IDC_TOPIC, event->pszText); +//if (wasFirstMessage) { + logEvent(event); +// } + return 1; +} + +int ChatWindow::changeRoomInfo(const MUCCEVENT *event) { + + Utils::log("setting room info !"); + setRoomName(event->pszName); + setRoomFlags(event->dwFlags); + return 1; +} + +const char * ChatWindow::getFontName(int index) { + const char *fontNames[] = {"Arial", + "Comic Sans MS", + "Courier New", + "Impact", + "Lucida Console", + "MS Sans Serif", + "Tahoma", + "Times New Roman", + "Trebuchet MS", + "Verdana"}; + if (index>9 || index<0) index = 0; + return fontNames[index]; +} +int ChatWindow::getFontNameNum() { + return 10; +} +int ChatWindow::getFontSize(int index) { + return index+7; +} +int ChatWindow::getFontSizeNum() { + return 10; +} + +void ChatWindow::refreshSettings() { + SendDlgItemMessage(hWnd, IDC_LOG, EM_SETBKGNDCOLOR , 0, Options::getLogBgColor()); + SendDlgItemMessage(hWnd, IDC_TREELIST, TVM_SETBKCOLOR, 0, Options::getListBgColor()); + eventList.setMaxSize(Options::getLogLimit()); +} + +void ChatWindow::refreshSettings(int force) { + + if (hListFont!=NULL && !force) { + return; + } + EnterCriticalSection(&mutex); + if (hListFont!=NULL) { + DeleteObject(hListFont); + } + if (hListGroupFont!=NULL) { + DeleteObject(hListGroupFont); + } + Font * font = Options::getFont(Options::FONT_USERLIST); + colorListText = font->getColor(); + hListFont = CreateFontA(font->getSize(), 0, 0, 0, + font->getStyle() & Font::BOLD ? FW_BOLD : FW_NORMAL, + font->getStyle() & Font::ITALIC ? 1 : 0, + font->getStyle() & Font::UNDERLINE ? 1 : 0, 0, + font->getCharSet(), + OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH | FF_ROMAN, + font->getFace()); + font = Options::getFont(Options::FONT_USERLISTGROUP); + colorListGroupText = font->getColor(); + hListGroupFont = CreateFontA(font->getSize(), 0, 0, 0, + font->getStyle() & Font::BOLD ? FW_BOLD : FW_NORMAL, + font->getStyle() & Font::ITALIC ? 1 : 0, + font->getStyle() & Font::UNDERLINE ? 1 : 0, 0, + font->getCharSet(), + OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH | FF_ROMAN, + font->getFace()); + + for (ChatWindow *ptr=list;ptr!=NULL;ptr=ptr->getNext()) { + ptr->refreshSettings(); + InvalidateRect(ptr->getHWND(), NULL, FALSE); + } + LeaveCriticalSection(&mutex); +} +HFONT ChatWindow::getListFont() { + return hListFont; +} + +HFONT ChatWindow::getListGroupFont() { + return hListGroupFont; +} + +COLORREF ChatWindow::getListTextColor() { + return colorListText; +} + +COLORREF ChatWindow::getListGroupTextColor() { + return colorListGroupText; +} + +HTREEITEM ChatWindow::getTreeItem(int index) { + return hUserGroups[index]; +} + +void ChatWindow::setTreeItem(int index, HTREEITEM hTreeItem) { + hUserGroups[index]=hTreeItem; +} + +int ChatWindow::getDefaultOptions() { + return FLAG_SHOW_NICKNAMES | FLAG_SHOW_TIMESTAMP | FLAG_FORMAT_ALL | FLAG_LOG_MESSAGES | FLAG_OPT_SENDONENTER; +} + +void ChatWindow::clearLog() { + if (getHWNDLog()!=NULL) { + IEVIEWEVENT iee; + ZeroMemory(&iee, sizeof(iee)); + iee.cbSize = sizeof(iee); + iee.iType = IEE_CLEAR_LOG; + iee.dwFlags = IEEF_NO_UNICODE; + iee.hwnd = hWndLog; + iee.hContact = NULL; + iee.codepage = CP_ACP; + iee.pszProto = getModule(); + CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&iee); + } else { + SetDlgItemTextA(getHWND(), IDC_LOG, ""); + } + isEmpty = true; + eventList.clear(); +} + +void ChatWindow::rebuildLog() { + int nMin, nMax; + HWND hwndLog; + if (getHWNDLog()!=NULL) { + IEVIEWEVENT iee; + ZeroMemory(&iee, sizeof(iee)); + iee.cbSize = sizeof(iee); + iee.iType = IEE_CLEAR_LOG; + iee.dwFlags = IEEF_NO_UNICODE; + iee.hwnd = hWndLog; + iee.hContact = NULL; + iee.codepage = CP_ACP; + iee.pszProto = getModule(); + CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&iee); + } else { + SetDlgItemTextA(getHWND(), IDC_LOG, ""); + } + isEmpty = true; + for (ChatEvent* event=eventList.getEvents();event!=NULL;event=event->getNext()) { + appendMessage(event->getEvent()); + } + if (getHWNDLog()==NULL) { + if (ServiceExists(MS_SMILEYADD_REPLACESMILEYS)) PostMessage(getHWND(), WM_TLEN_SMILEY, 0, 0); + hwndLog = GetDlgItem(getHWND(), IDC_LOG); + int len = GetWindowTextLengthA(hwndLog); + SendMessage(hwndLog, EM_SETSEL, len - 1, len - 1); + GetScrollRange(hwndLog, SB_VERT, &nMin, &nMax); + SetScrollPos(hwndLog, SB_VERT, nMax, TRUE); + PostMessage(hwndLog, WM_VSCROLL, MAKEWPARAM(SB_THUMBPOSITION, nMax), (LPARAM) NULL); + } +} + +int ChatWindow::logEvent(const MUCCEVENT *event) { + /* chat.dll mod*/ + /* + if (event->iType == MUCC_EVENT_MESSAGE) { + GCDEST gcdest; + GCEVENT gcevent = {sizeof(GCEVENT), &gcdest}; + gcdest.pszModule = (char *)this->getModule(); + gcdest.pszID = (char *)this->getRoomId(); + gcdest.iType = GC_EVENT_MESSAGE; + gcevent.pszText = event->pszText; + gcevent.pszNick = event->pszNick; + gcevent.pszUID = event->pszUID; + gcevent.bIsMe = event->bIsMe; + gcevent.bAddToLog = TRUE; + gcevent.time = event->time; + CallService(MS_GC_EVENT, 0, (LPARAM)&gcevent); + + } + if (event->iType == MUCC_EVENT_STATUS) { + const char *groupNames[] = {"Global Owners", "Owners", "Admins", "Moderators", "Users"}; + GCDEST gcdest; + GCEVENT gcevent = {sizeof(GCEVENT), &gcdest}; + gcdest.pszModule = (char *)this->getModule(); + gcdest.pszID = (char *)this->getRoomId(); + gcevent.pszText = event->pszText; + gcevent.pszNick = event->pszNick; + int group = 4; + if (event->dwFlags&MUCC_EF_USER_GLOBALOWNER) { + group = 0; + } else if (event->dwFlags&MUCC_EF_USER_OWNER) { + group = 1; + } else if (event->dwFlags&MUCC_EF_USER_ADMIN) { + group = 2; + } else if (event->dwFlags&MUCC_EF_USER_MODERATOR) { + group = 3; + } + gcevent.pszStatus = Translate(groupNames[group]); + gcevent.pszUID = event->pszUID; + gcevent.bIsMe = event->bIsMe; + gcevent.bAddToLog = TRUE; + gcevent.time = event->time; + if (event->dwData == ID_STATUS_ONLINE) { + gcdest.iType = GC_EVENT_JOIN; + } else { + gcdest.iType = GC_EVENT_PART; + } + CallService(MS_GC_EVENT, 0, (LPARAM)&gcevent); + } + */ + /* chat.dll mod*/ + + int nMin, nMax; + HWND hwndLog; + if (event->iType != MUCC_EVENT_ERROR) { + if (eventList.addEvent(event)) { + rebuildLog(); + return 1; + } + } + if (event->iType == MUCC_EVENT_MESSAGE) { + wasFirstMessage = 1; + appendMessage(event); + container->remoteSetUnread(this, 1); + } else { + appendMessage(event); + } + if (event->iType==MUCC_EVENT_MESSAGE && getOptions() & FLAG_FLASH_MESSAGES) { + container->remoteFlashWindow(); + } else if (event->iType==MUCC_EVENT_STATUS && event->dwData==ID_STATUS_ONLINE && getOptions() & FLAG_FLASH_JOINED) { + container->remoteFlashWindow(); + } else if (event->iType==MUCC_EVENT_STATUS && event->dwData==ID_STATUS_OFFLINE && getOptions() & FLAG_FLASH_LEFT) { + container->remoteFlashWindow(); + } else if (event->iType==MUCC_EVENT_TOPIC && getOptions() & FLAG_FLASH_TOPIC) { + container->remoteFlashWindow(); + } + if (getHWNDLog()==NULL) { + if (ServiceExists(MS_SMILEYADD_REPLACESMILEYS)) PostMessage(getHWND(), WM_TLEN_SMILEY, 0, 0); + hwndLog = GetDlgItem(getHWND(), IDC_LOG); + int len = GetWindowTextLengthA(hwndLog); + SendMessage(hwndLog, EM_SETSEL, len - 1, len - 1); + GetScrollRange(hwndLog, SB_VERT, &nMin, &nMax); + SetScrollPos(hwndLog, SB_VERT, nMax, TRUE); + PostMessage(hwndLog, WM_VSCROLL, MAKEWPARAM(SB_THUMBPOSITION, nMax), (LPARAM) NULL); + } + return 1; +} + +void ChatWindow::createRTFHeader() { + char *rtf; + int i, msgSize; + //, , iFontSize, bItalic, bBold, bUnderline; + rtf = NULL; + JabberStringAppend(&rtf, &msgSize, "{\\rtf1\\ansi\\deff0{\\fonttbl"); + + for (i=0;igetCharSet(), font->getFace()); + } + JabberStringAppend(&rtf, &msgSize, "}{\\colortbl "); + for (i=0;igetColor(); + JabberStringAppend(&rtf, &msgSize, "\\red%d\\green%d\\blue%d;", color&0xFF, (color>>8)&0xFF, (color>>16)&0xFF); + } + JabberStringAppend(&rtf, &msgSize, "}"); +} + + +int ChatWindow::appendMessage(const MUCCEVENT *event) { + char timestampStr[100], str[512]; + char *rtf, *escapedStr = NULL, *escapedNick = NULL; + Font *fontTimestamp, *fontName, *fontMessage; //*fontColon, + int msgSize; + DWORD color; + int iFontSize, bItalic, bBold, bUnderline; + HWND hwndLog; + DBTIMETOSTRING dbtts; + CHARRANGE sel; + SETTEXTEX stt; + //tm *ltime; + + if (event->iType!=MUCC_EVENT_STATUS && event->iType!=MUCC_EVENT_STATUS && event->iType!=MUCC_EVENT_ERROR + && event->iType!=MUCC_EVENT_TOPIC && event->iType != MUCC_EVENT_MESSAGE) { + return 0; + } + if (event->iType==MUCC_EVENT_MESSAGE && !(getOptions() & FLAG_LOG_MESSAGES)) { + return 0; + } else if (event->iType==MUCC_EVENT_STATUS && event->dwData==ID_STATUS_ONLINE && !(getOptions() & FLAG_LOG_JOINED)) { + return 0; + } else if (event->iType==MUCC_EVENT_STATUS && event->dwData==ID_STATUS_OFFLINE && !(getOptions() & FLAG_LOG_LEFT)) { + return 0; + } else if (event->iType==MUCC_EVENT_TOPIC && !(getOptions() & FLAG_LOG_TOPIC)) { + return 0; + } + + if (getHWNDLog()!=NULL) { + IEVIEWEVENTDATA ied; + IEVIEWEVENT iee; + IEVIEWWINDOW iew; + ZeroMemory(&iee, sizeof(iee)); + iee.cbSize = sizeof(iee); + iee.dwFlags = IEEF_NO_UNICODE; + iee.hwnd = hWndLog; + iee.hContact = NULL; + iee.iType = IEE_LOG_MEM_EVENTS; + iee.codepage = CP_ACP; + iee.pszProto = getModule(); + iee.eventData = &ied; + iee.count = 1; + + ied.cbSize = sizeof(IEVIEWEVENTDATA); + if (event->iType==MUCC_EVENT_MESSAGE) { + ied.iType = IEED_MUCC_EVENT_MESSAGE; + } else if (event->iType==MUCC_EVENT_STATUS && event->dwData==ID_STATUS_ONLINE) { + ied.iType = IEED_MUCC_EVENT_JOINED; + } else if (event->iType==MUCC_EVENT_STATUS && event->dwData==ID_STATUS_OFFLINE) { + ied.iType = IEED_MUCC_EVENT_LEFT; + } else if (event->iType==MUCC_EVENT_TOPIC) { + ied.iType = IEED_MUCC_EVENT_TOPIC; + } else if (event->iType==MUCC_EVENT_ERROR) { + ied.iType = IEED_MUCC_EVENT_ERROR; + } + ied.dwFlags = getOptions() & FLAG_FORMAT_ALL; + ied.next = NULL; + ied.color = event->color; + ied.fontSize = event->iFontSize; + ied.fontStyle = event->dwFlags; + ied.fontName = getFontName(event->iFont); + ied.pszNick = event->pszNick; + ied.pszText = event->pszText; + ied.time = event->time; + ied.dwData = getOptions(); // event->dwData; + ied.bIsMe = event->bIsMe; + CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&iee); + + iew.cbSize = sizeof(IEVIEWWINDOW); + iew.iType = IEW_SCROLLBOTTOM; + iew.hwnd = hWndLog; + CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&iew); + return 1; + } + rtf = NULL; + fontTimestamp = FontList::getFont(FontList::FONT_TIMESTAMP); +// fontColon = FontList::getFont(FontList::FONT_COLON); + if (event->iType == MUCC_EVENT_MESSAGE) { + escapedStr=JabberRtfEscape((char *)event->pszText); + escapedNick=JabberRtfEscape((char *)event->pszNick); + if (event->bIsMe) { + fontName = FontList::getFont(FontList::FONT_MYNAME); + fontMessage = FontList::getFont(FontList::FONT_OUTMESSAGE); + } else { + fontName = FontList::getFont(FontList::FONT_OTHERSNAMES); + fontMessage = FontList::getFont(FontList::FONT_INMESSAGE); + } + } else { + fontName = FontList::getFont(FontList::FONT_ERROR); + if (event->iType == MUCC_EVENT_ERROR) { + escapedStr = JabberRtfEscape((char *)event->pszText); + fontMessage = FontList::getFont(FontList::FONT_ERROR); + } else if (event->iType == MUCC_EVENT_STATUS) { + if (event->dwData == ID_STATUS_ONLINE) { + fontMessage = FontList::getFont(FontList::FONT_JOINED); + _snprintf(str, sizeof(str), Translate("%s has joined."), event->pszNick); + } else { + fontMessage = FontList::getFont(FontList::FONT_LEFT); + _snprintf(str, sizeof(str), Translate("%s has left."), event->pszNick); + } + escapedStr = JabberRtfEscape(str); + } else if (event->iType == MUCC_EVENT_TOPIC) { + fontMessage = FontList::getFont(FontList::FONT_TOPIC); + _snprintf(str, sizeof(str), Translate("The topic is %s."), event->pszText); + escapedStr = JabberRtfEscape(str); + } + } + //ltime = localtime(&event->time); + JabberStringAppend(&rtf, &msgSize, "{\\rtf1\\ansi\\deff0{\\fonttbl"); + JabberStringAppend(&rtf, &msgSize, "{\\f0\\fnil\\fcharset%u %s;}", fontTimestamp->getCharSet(), fontTimestamp->getFace()); + JabberStringAppend(&rtf, &msgSize, "{\\f1\\fnil\\fcharset%u %s;}", fontName->getCharSet(), fontName->getFace()); + if (event->iType == MUCC_EVENT_MESSAGE && getOptions()&FLAG_FORMAT_FONT) { + JabberStringAppend(&rtf, &msgSize, "{\\f2\\fnil\\fcharset%u %s;}", fontMessage->getCharSet(), getFontName(event->iFont)); + } else { + JabberStringAppend(&rtf, &msgSize, "{\\f2\\fnil\\fcharset%u %s;}", fontMessage->getCharSet(), fontMessage->getFace()); + } + JabberStringAppend(&rtf, &msgSize, "}{\\colortbl "); + color = fontTimestamp->getColor(); + JabberStringAppend(&rtf, &msgSize, "\\red%d\\green%d\\blue%d;", color&0xFF, (color>>8)&0xFF, (color>>16)&0xFF); + color = fontName->getColor(); + JabberStringAppend(&rtf, &msgSize, "\\red%d\\green%d\\blue%d;", color&0xFF, (color>>8)&0xFF, (color>>16)&0xFF); + if (event->iType == MUCC_EVENT_MESSAGE && getOptions()&FLAG_FORMAT_COLOR && event->color!=0xFFFFFFFF) { + color = event->color; + } else { + color = fontMessage->getColor(); + } + JabberStringAppend(&rtf, &msgSize, "\\red%d\\green%d\\blue%d;", color&0xFF, (color>>8)&0xFF, (color>>16)&0xFF); + JabberStringAppend(&rtf, &msgSize, "}\\pard"); + if (!isEmpty) { + JabberStringAppend(&rtf, &msgSize, "\\par"); + } + isEmpty = false; + if (event->iType == MUCC_EVENT_MESSAGE) { + if (getOptions()&FLAG_SHOW_DATE || getOptions()&FLAG_SHOW_TIMESTAMP) { + bBold = fontTimestamp->getStyle() & Font::BOLD ? 1 : 0; + bItalic = fontTimestamp->getStyle() & Font::ITALIC ? 1 : 0; + bUnderline = fontTimestamp->getStyle() & Font::UNDERLINE ? 1 : 0; + iFontSize = fontTimestamp->getSize(); + iFontSize = 2 * abs((signed char)iFontSize) * 74 / logPixelSY; + dbtts.cbDest = 90; + dbtts.szDest = timestampStr; + timestampStr[0]='\0'; + //time_t time = time + if (getOptions()&FLAG_SHOW_DATE && getOptions()&FLAG_SHOW_TIMESTAMP) { + if (getOptions()&FLAG_LONG_DATE) { + dbtts.szFormat = getOptions()&FLAG_SHOW_SECONDS ? (char *)"D s" : (char *)"D t"; + } else { + dbtts.szFormat = getOptions()&FLAG_SHOW_SECONDS ? (char *)"d s" : (char *)"d t"; + } + } else if (getOptions()&FLAG_SHOW_DATE) { + dbtts.szFormat = getOptions()&FLAG_LONG_DATE ? (char *)"D" : (char *)"d"; + } else if (getOptions()&FLAG_SHOW_TIMESTAMP) { + dbtts.szFormat = getOptions()&FLAG_SHOW_SECONDS ? (char *)"s" : (char *)"t"; + } else { + dbtts.szFormat = (char *)""; + } + CallService(MS_DB_TIME_TIMESTAMPTOSTRING, (WPARAM)event->time, (LPARAM) & dbtts); + JabberStringAppend(&rtf, &msgSize, "\\f0\\cf0\\fs%d\\b%d\\i%d%s %s ", + iFontSize, + bBold, + bItalic, + bUnderline?"\\ul":"", + timestampStr); + } + bBold = fontName->getStyle() & Font::BOLD ? 1 : 0; + bItalic = fontName->getStyle() & Font::ITALIC ? 1 : 0; + bUnderline = fontName->getStyle() & Font::UNDERLINE ? 1 : 0; + iFontSize = fontName->getSize(); + iFontSize = 2 * abs((signed char)iFontSize) * 74 / logPixelSY; + if (getOptions()&FLAG_SHOW_NICKNAMES) { + JabberStringAppend(&rtf, &msgSize, "\\f1\\cf1\\fs%d\\b%d\\i%d%s %s: ", + iFontSize, + bBold, + bItalic, + bUnderline?"\\ul":"", + escapedNick); + } + bBold = fontMessage->getStyle() & Font::BOLD ? 1 : 0; + bItalic = fontMessage->getStyle() & Font::ITALIC ? 1 : 0; + bUnderline = fontMessage->getStyle() & Font::UNDERLINE ? 1 : 0; + iFontSize = fontMessage->getSize(); + iFontSize = 2 * abs((signed char)iFontSize) * 74 / logPixelSY; + if (getOptions()&FLAG_FORMAT_STYLE) { + bBold = bItalic = bUnderline = 0; + if (event->dwFlags & MUCC_EF_FONT_BOLD) bBold = 1; + if (event->dwFlags & MUCC_EF_FONT_ITALIC) bItalic = 1; + if (event->dwFlags & MUCC_EF_FONT_UNDERLINE) bUnderline = 1; + } + if (getOptions()&FLAG_FORMAT_SIZE) { + if (event->iFontSize != 0) iFontSize = 2 * event->iFontSize; + } + if (getOptions()&FLAG_MSGINNEWLINE) { + JabberStringAppend(&rtf, &msgSize, "\\line"); + } + JabberStringAppend(&rtf, &msgSize, "\\f2\\cf2\\fs%d\\b%d\\i%d%s %s", + iFontSize, + bBold, + bItalic, + bUnderline?"\\ul":"", + escapedStr); + } else { + if (event->iType == MUCC_EVENT_ERROR) { + bBold = fontName->getStyle() & Font::BOLD ? 1 : 0; + bItalic = fontName->getStyle() & Font::ITALIC ? 1 : 0; + bUnderline = fontName->getStyle() & Font::UNDERLINE ? 1 : 0; + iFontSize = fontName->getSize(); + iFontSize = 2 * abs((signed char)iFontSize) * 74 / logPixelSY; + JabberStringAppend(&rtf, &msgSize, "\\f1\\cf1\\fs%d\\b%d\\i%d%s %s: ", + iFontSize, + bBold, + bItalic, + bUnderline?"\\ul":"", + Translate("Error")); + } else { + if (getOptions()&FLAG_SHOW_DATE || getOptions()&FLAG_SHOW_TIMESTAMP) { + bBold = fontTimestamp->getStyle() & Font::BOLD ? 1 : 0; + bItalic = fontTimestamp->getStyle() & Font::ITALIC ? 1 : 0; + bUnderline = fontTimestamp->getStyle() & Font::UNDERLINE ? 1 : 0; + iFontSize = fontTimestamp->getSize(); + iFontSize = 2 * abs((signed char)iFontSize) * 74 / logPixelSY; + dbtts.cbDest = 90; + dbtts.szDest = timestampStr; + timestampStr[0]='\0'; + //time_t time = time + if (getOptions()&FLAG_SHOW_DATE && getOptions()&FLAG_SHOW_TIMESTAMP) { + if (getOptions()&FLAG_LONG_DATE) { + dbtts.szFormat = getOptions()&FLAG_SHOW_SECONDS ? (char *)"D s" : (char *)"D t"; + } else { + dbtts.szFormat = getOptions()&FLAG_SHOW_SECONDS ? (char *)"d s" : (char *)"d t"; + } + } else if (getOptions()&FLAG_SHOW_DATE) { + dbtts.szFormat = getOptions()&FLAG_LONG_DATE ? (char *)"D" : (char *)"d"; + } else if (getOptions()&FLAG_SHOW_TIMESTAMP) { + dbtts.szFormat = getOptions()&FLAG_SHOW_SECONDS ? (char *)"s" : (char *)"t"; + } else { + dbtts.szFormat = (char *)""; + } + CallService(MS_DB_TIME_TIMESTAMPTOSTRING, (WPARAM)event->time, (LPARAM) & dbtts); + JabberStringAppend(&rtf, &msgSize, "\\f0\\cf0\\fs%d\\b%d\\i%d%s %s ", + iFontSize, + bBold, + bItalic, + bUnderline?"\\ul":"", + timestampStr); + } + } + bBold = fontMessage->getStyle() & Font::BOLD ? 1 : 0; + bItalic = fontMessage->getStyle() & Font::ITALIC ? 1 : 0; + bUnderline = fontMessage->getStyle() & Font::UNDERLINE ? 1 : 0; + iFontSize = fontMessage->getSize(); + iFontSize = 2 * abs((signed char)iFontSize) * 74 / logPixelSY; + JabberStringAppend(&rtf, &msgSize, "\\f2\\cf2\\fs%d\\b%d\\i%d%s %s", + iFontSize, + bBold, + bItalic, + bUnderline?"\\ul":"", + escapedStr); + } + JabberStringAppend(&rtf, &msgSize, "}"); + hwndLog = GetDlgItem(getHWND(), IDC_LOG); + sel.cpMin = sel.cpMax = GetWindowTextLength(hwndLog); + SendMessage(hwndLog, EM_EXSETSEL, 0, (LPARAM) &sel); + stt.flags = ST_SELECTION; + stt.codepage = CP_ACP; + SendMessage(hwndLog, EM_SETTEXTEX, (WPARAM) &stt, (LPARAM) rtf); + free(rtf); + if (escapedStr!=NULL) free(escapedStr); + if (escapedNick!=NULL) free(escapedNick); + return 1; +} + +void ChatWindow::setFont(int font, int size, int bBold, int bItalic, int bUnderline, COLORREF color) { + if (hEditFont!=NULL) { + DeleteObject(hEditFont); + } + hEditFont = CreateFontA(MulDiv(-size, logPixelSY, 74), 0, 0, 0, bBold?FW_BOLD:FW_NORMAL, + bItalic, bUnderline, 0, 238, OUT_DEFAULT_PRECIS, + CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, + FIXED_PITCH | FF_ROMAN, + getFontName(font)); + SendDlgItemMessage(hWnd, IDC_EDIT, WM_SETFONT, (WPARAM) hEditFont, TRUE); + this->font = font; + this->fontSize = size; + this->bBold = bBold; + this->bItalic = bItalic; + this->bUnderline = bUnderline; + this->fontColor = color; +} + +int ChatWindow::getFontStyle() { + int style = 0; + if (bBold) style |= MUCC_EF_FONT_BOLD; + if (bItalic) style |= MUCC_EF_FONT_ITALIC; + if (bUnderline) style |= MUCC_EF_FONT_UNDERLINE; + return style; +} + +int ChatWindow::getFont() { + return font; +} + +int ChatWindow::getFontSize() { + return fontSize; +} + +COLORREF ChatWindow::getFontColor() { + return fontColor; +} + +void ChatWindow ::queryResultContacts(MUCCQUERYRESULT *queryResult) { + HelperDialog::inviteDlg(this, queryResult); +} + +void ChatWindow ::queryResultUsers(MUCCQUERYRESULT *queryResult) { + if (adminWindow!=NULL) { + adminWindow->queryResultUsers(queryResult); + } +} + +ChatWindow * ChatWindow::getWindow(const char *module, const char *roomId) { + ChatWindow *ptr; + EnterCriticalSection(&mutex); + for (ptr=list;ptr!=NULL;ptr=ptr->getNext()) { + if (strcmp(ptr->getRoomId(), roomId)==0 && strcmp(ptr->getModule(), module)==0) { + break; + } + } + LeaveCriticalSection(&mutex); + return ptr; +} + + +static DWORD CALLBACK EditStreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb) +{ + char *szFilename = (char *)dwCookie; + FILE *file; + file = fopen(szFilename, "ab"); + if (file != NULL) { + *pcb = (LONG)fwrite(pbBuff, (size_t)cb, (size_t)1, file); + fclose(file); + return 0; + } + return 1; +} + +static BOOL CALLBACK EditWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + ChatWindow *chat; + chat = (ChatWindow *) GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA); + switch (msg) { +// case WM_GETDLGCODE: +// return DLGC_WANTALLKEYS; //DLGC_WANTARROWS|DLGC_WANTCHARS|DLGC_HASSETSEL|DLGC_WANTALLKEYS; + case WM_CHAR: + if (wParam=='\r' || wParam=='\n') { + if (((GetKeyState(VK_CONTROL)&0x8000)==0) == ((Options::getChatWindowOptions() & ChatWindow::FLAG_OPT_SENDONENTER) != 0)) { + PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0); + return FALSE; + } + } + if (wParam == 1 && GetKeyState(VK_CONTROL) & 0x8000) { //ctrl-a + SendMessage(hwnd, EM_SETSEL, 0, -1); + return 0; + } + if (wParam == 23 && GetKeyState(VK_CONTROL) & 0x8000) { // ctrl-w + SendMessage(GetParent(hwnd), WM_CLOSE, 0, 0); + return 0; + } + break; + } + return CallWindowProc(oldEditWndProc, hwnd, msg, wParam, lParam); +} + +static BOOL CALLBACK SplitterWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + ChatWindow *chat; + chat = (ChatWindow *) GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA); + switch (msg) { + case WM_NCHITTEST: + return HTCLIENT; + case WM_SETCURSOR: + RECT rc; + GetClientRect(hwnd, &rc); + SetCursor(rc.right > rc.bottom ? hCurSplitNS : hCurSplitWE); + return TRUE; + case WM_LBUTTONDOWN: + SetCapture(hwnd); + return 0; + case WM_MOUSEMOVE: + if (GetCapture() == hwnd) { + HWND hParent; + RECT rc; + POINT pt; + hParent = GetParent(hwnd); + GetClientRect(hwnd, &rc); + if (rc.right < rc.bottom) { + pt.x = LOWORD(GetMessagePos()); + GetClientRect(hParent, &rc); + ScreenToClient(hParent, &pt); + if (pt.x < chat->vSplitterMinLeft) + pt.x = chat->vSplitterMinLeft; + if (rc.right-pt.x < chat->vSplitterMinRight) + pt.x = rc.right-chat->vSplitterMinRight; + if (chat->vSplitterPos != rc.right-pt.x) { + chat->vSplitterPos = rc.right-pt.x; + SendMessage(hParent, WM_SIZE, SIZE_RESTORED, (rc.bottom<<16)+rc.right); + } + } else { + pt.y = HIWORD(GetMessagePos()); + GetClientRect(hParent, &rc); + ScreenToClient(hParent, &pt); + if (pt.y < chat->hSplitterMinTop) + pt.y = chat->hSplitterMinTop; + if (rc.bottom-pt.y < chat->hSplitterMinBottom) + pt.y = rc.bottom-chat->hSplitterMinBottom; + if (chat->hSplitterPos != rc.bottom-pt.y) { + chat->hSplitterPos = rc.bottom-pt.y; + SendMessage(hParent, WM_SIZE, SIZE_RESTORED, (rc.bottom<<16)+rc.right); + } + } + } + return 0; + case WM_LBUTTONUP: + ReleaseCapture(); + return 0; + } + return CallWindowProc(oldSplitterWndProc, hwnd, msg, wParam, lParam); +} + + + + +static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + int i; + ChatWindow *chatWindow; + chatWindow = (ChatWindow *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + if (msg!=WM_INITDIALOG && chatWindow==NULL) { + return FALSE; + } + switch (msg) { + case WM_INITDIALOG: + HDC hdc; + TranslateDialogDefault(hwndDlg); + hdc = GetDC(NULL); + logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); + ReleaseDC(NULL, hdc); + SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) muccIcon[MUCC_IDI_CHAT]); + + chatWindow = (ChatWindow *) lParam; + chatWindow->setHWND(hwndDlg); + ChatWindow::refreshSettings(0); + oldSplitterWndProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_HSPLIT), GWLP_WNDPROC, (LONG_PTR) SplitterWndProc); + oldSplitterWndProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_VSPLIT), GWLP_WNDPROC, (LONG_PTR) SplitterWndProc); + oldEditWndProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EDIT), GWLP_WNDPROC, (LONG_PTR) EditWndProc); + ShowWindow(GetDlgItem(hwndDlg, IDC_LIST), SW_HIDE); + chatWindow->hSplitterMinTop = 90; + chatWindow->hSplitterMinBottom = 40; + chatWindow->hSplitterPos=50; + chatWindow->vSplitterMinLeft = 100; + chatWindow->vSplitterMinRight = 80; + chatWindow->vSplitterPos=110; + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) chatWindow); + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EDIT), GWLP_USERDATA, (LONG_PTR) chatWindow); + chatWindow->refreshSettings(); + + SetWindowTextA(hwndDlg, chatWindow->getRoomName()); + SendDlgItemMessage(hwndDlg, IDC_BOLD, BM_SETIMAGE, IMAGE_ICON, (LPARAM) muccIcon[MUCC_IDI_BOLD]); + SendDlgItemMessage(hwndDlg, IDC_ITALIC, BM_SETIMAGE, IMAGE_ICON, (LPARAM) muccIcon[MUCC_IDI_ITALIC]); + SendDlgItemMessage(hwndDlg, IDC_UNDERLINE, BM_SETIMAGE, IMAGE_ICON, (LPARAM) muccIcon[MUCC_IDI_UNDERLINE]); + SendDlgItemMessage(hwndDlg, IDC_SMILEYBTN, BM_SETIMAGE, IMAGE_ICON, (LPARAM) muccIcon[MUCC_IDI_SMILEY]); + + SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_LINK); + SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETUNDOLIMIT, 0, 0); + SendDlgItemMessage(hwndDlg, IDC_LOG, EM_AUTOURLDETECT, (WPARAM) TRUE, 0); + + // LoadImage(hInst, smadd_iconinfo.SmileyIcon, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)); + SendDlgItemMessage(hwndDlg, IDC_OPTIONS, BM_SETIMAGE, IMAGE_ICON, (LPARAM) muccIcon[MUCC_IDI_OPTIONS]); + SendDlgItemMessage(hwndDlg, IDC_INVITE, BM_SETIMAGE, IMAGE_ICON, (LPARAM) muccIcon[MUCC_IDI_INVITE]); + + SendDlgItemMessage(hwndDlg, IDC_TOPIC_BUTTON, BUTTONSETASFLATBTN, 0, 0); + SendDlgItemMessage(hwndDlg, IDC_INVITE, BUTTONSETASFLATBTN, 0, 0); + SendDlgItemMessage(hwndDlg, IDC_BOLD, BUTTONSETASFLATBTN, 0, 0); + SendDlgItemMessage(hwndDlg, IDC_BOLD, BUTTONSETASPUSHBTN, 0, 0); + SendDlgItemMessage(hwndDlg, IDC_ITALIC, BUTTONSETASFLATBTN, 0, 0); + SendDlgItemMessage(hwndDlg, IDC_ITALIC, BUTTONSETASPUSHBTN, 0, 0); + SendDlgItemMessage(hwndDlg, IDC_UNDERLINE, BUTTONSETASFLATBTN, 0, 0); + SendDlgItemMessage(hwndDlg, IDC_UNDERLINE, BUTTONSETASPUSHBTN, 0, 0); + SendDlgItemMessage(hwndDlg, IDC_OPTIONS, BUTTONSETASFLATBTN, 0, 0); + SendDlgItemMessage(hwndDlg, IDC_SMILEYBTN, BUTTONSETASFLATBTN, 0, 0); + + SetWindowLong(GetDlgItem(hwndDlg,IDC_TREELIST),GWL_STYLE,GetWindowLong(GetDlgItem(hwndDlg,IDC_TREELIST),GWL_STYLE)|TVS_NOHSCROLL); + SendDlgItemMessage(hwndDlg,IDC_TREELIST, CCM_SETVERSION,(WPARAM)5,0); + //TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_TREELIST), hImageList, TVSIL_STATE); + TreeView_SetItemHeight(GetDlgItem(hwndDlg, IDC_TREELIST), 16); + TreeView_SetIndent(GetDlgItem(hwndDlg, IDC_TREELIST), 16); + for(i=0;igetFontSizeNum();i++) { + char str[10]; + sprintf(str, "%d", chatWindow->getFontSize(i)); + int n = SendDlgItemMessageA(hwndDlg, IDC_FONTSIZE, CB_ADDSTRING, 0, (LPARAM) str); + SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_SETITEMDATA, n, chatWindow->getFontSize(i)); + } + SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_SETCURSEL, Options::getChatWindowFontSize(), 0); + for(i=0;igetFontNameNum();i++) { + int n = SendDlgItemMessageA(hwndDlg, IDC_FONT, CB_ADDSTRING, 0, (LPARAM) chatWindow->getFontName(i)); + SendDlgItemMessage(hwndDlg, IDC_FONT, CB_SETITEMDATA, n, i); + } + SendDlgItemMessage(hwndDlg, IDC_FONT, CB_SETCURSEL, Options::getChatWindowFont(), 0); + CheckDlgButton(hwndDlg, IDC_BOLD, Options::getChatWindowFontStyle()&Font::BOLD ? TRUE : FALSE); + CheckDlgButton(hwndDlg, IDC_ITALIC, Options::getChatWindowFontStyle()&Font::ITALIC ? TRUE : FALSE); + CheckDlgButton(hwndDlg, IDC_UNDERLINE, Options::getChatWindowFontStyle()&Font::UNDERLINE ? TRUE : FALSE); + SendDlgItemMessage(hwndDlg, IDC_COLOR, CPM_SETCOLOUR, 0, (LPARAM)Options::getChatWindowFontColor()); + chatWindow->setFont(Options::getChatWindowFont(), + chatWindow->getFontSize(Options::getChatWindowFontSize()), + Options::getChatWindowFontStyle()&Font::BOLD ? 1 : 0, + Options::getChatWindowFontStyle()&Font::ITALIC ? 1 : 0, + Options::getChatWindowFontStyle()&Font::UNDERLINE ? 1 : 0, + Options::getChatWindowFontColor()); + if (ServiceExists(MS_IEVIEW_WINDOW) && Options::getChatWindowOptions() & ChatWindow::FLAG_OPT_ENABLEIEVIEW) { + IEVIEWWINDOW ieWindow; + ieWindow.cbSize = sizeof(IEVIEWWINDOW); + ieWindow.iType = IEW_CREATE; + ieWindow.dwFlags = 0; + ieWindow.dwMode = IEWM_MUCC; + ieWindow.parent = hwndDlg; + ieWindow.x = 0; + ieWindow.y = 0; + ieWindow.cx = 200; + ieWindow.cy = 300; + CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow); + chatWindow->setHWNDLog(ieWindow.hwnd); + ShowWindow(GetDlgItem(hwndDlg, IDC_LOG), SW_HIDE); + } + SetWindowPos(hwndDlg, HWND_TOP, 0, 0, 540, 370, SWP_NOMOVE | SWP_SHOWWINDOW); + SetFocus(GetDlgItem(hwndDlg, IDC_EDIT)); + chatWindow->clearLog(); + SetEvent(chatWindow->getEvent()); + return TRUE; + break; + case DM_CHAT_EVENT: + MUCCEVENT *mucEvent; + mucEvent = (MUCCEVENT *) lParam; + switch (mucEvent->iType) { + case MUCC_EVENT_MESSAGE: + chatWindow->logEvent(mucEvent); + break; + case MUCC_EVENT_TOPIC: + chatWindow->changeTopic(mucEvent); + break; + case MUCC_EVENT_STATUS: + chatWindow->changePresence(mucEvent); + break; + case MUCC_EVENT_ERROR: + chatWindow->logEvent(mucEvent); + break; + //case MUCC_EVENT_LEAVE: + // DestroyWindow(hwndDlg); + // break; + case MUCC_EVENT_ROOM_INFO: + chatWindow->changeRoomInfo(mucEvent); + break; + } + return TRUE; + case DM_CHAT_QUERY: + MUCCQUERYRESULT *queryResult; + queryResult = (MUCCQUERYRESULT *)lParam; + switch (queryResult->iType) { + case MUCC_EVENT_QUERY_CONTACTS: + chatWindow->queryResultContacts(queryResult); + break; + case MUCC_EVENT_QUERY_USERS: + chatWindow->queryResultUsers(queryResult); + break; + + } + return TRUE; + case WM_SETFOCUS: + SetFocus(GetDlgItem(hwndDlg, IDC_EDIT)); + return TRUE; + case WM_GETMINMAXINFO: + MINMAXINFO *mmi; + mmi = (MINMAXINFO *) lParam; + mmi->ptMinTrackSize.x = 370; + mmi->ptMinTrackSize.y = 130; + return FALSE; + case WM_SIZE: + if (wParam!=SIZE_MINIMIZED) { + int dlgWidth, dlgHeight; + RECT rc; + HDWP hdwp; + GetClientRect(hwndDlg, &rc); + dlgWidth = rc.right-rc.left; + dlgHeight = rc.bottom-rc.top; + if (dlgHeight-chatWindow->hSplitterPos < chatWindow->hSplitterMinTop) { + chatWindow->hSplitterPos = dlgHeight-chatWindow->hSplitterMinTop; + } + if (chatWindow->hSplitterPos < chatWindow->hSplitterMinBottom) { + chatWindow->hSplitterPos = chatWindow->hSplitterMinBottom; + } + if (dlgWidth-chatWindow->vSplitterPos < chatWindow->vSplitterMinLeft) { + chatWindow->vSplitterPos = dlgWidth-chatWindow->vSplitterMinLeft; + } + if (chatWindow->vSplitterPos < chatWindow->vSplitterMinRight) { + chatWindow->vSplitterPos = chatWindow->vSplitterMinRight; + } + + hdwp = BeginDeferWindowPos(15); + hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_TOPIC), 0, 70, 7, dlgWidth-140, 18, SWP_NOZORDER); + hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_LOG), 0, 0, 30, dlgWidth-(chatWindow->vSplitterPos)-2, dlgHeight-(chatWindow->hSplitterPos)-30-26-2, SWP_NOZORDER); + hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_TREELIST), 0, dlgWidth-(chatWindow->vSplitterPos)+2, 30, (chatWindow->vSplitterPos)-2, dlgHeight-(chatWindow->hSplitterPos)-30-26-2, SWP_NOZORDER); + hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_EDIT), 0, 0, dlgHeight-(chatWindow->hSplitterPos)+2, dlgWidth, (chatWindow->hSplitterPos)-5, SWP_NOZORDER); + hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_INVITE), 0, dlgWidth-31, dlgHeight-(chatWindow->hSplitterPos)-26, 31, 24, SWP_NOZORDER); + hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_BOLD), 0, 0, dlgHeight-(chatWindow->hSplitterPos)-26, 24, 24, SWP_NOZORDER ); + hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_ITALIC), 0, 24, dlgHeight-(chatWindow->hSplitterPos)-26, 24, 24, SWP_NOZORDER ); + hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_UNDERLINE), 0, 48, dlgHeight-(chatWindow->hSplitterPos)-26, 24, 24, SWP_NOZORDER ); + hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_COLOR), 0, 73, dlgHeight-(chatWindow->hSplitterPos)-25, 22, 22, SWP_NOZORDER ); + hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_FONT), 0, 98, dlgHeight-(chatWindow->hSplitterPos)-24, 110, 13, SWP_NOZORDER); + hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_FONTSIZE), 0, 213, dlgHeight-(chatWindow->hSplitterPos)-24, 38, 13, SWP_NOZORDER); + hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_SMILEYBTN), 0, 265, dlgHeight-(chatWindow->hSplitterPos)-26, 24, 24, SWP_NOZORDER); + hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_OPTIONS), 0, dlgWidth-79, dlgHeight-(chatWindow->hSplitterPos)-26, 24, 24, SWP_NOZORDER); + hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_VSPLIT), 0, dlgWidth-(chatWindow->vSplitterPos)-2, 30, 4, dlgHeight-(chatWindow->hSplitterPos)-30-26-2, SWP_NOZORDER); + hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_HSPLIT), 0, 0, dlgHeight-(chatWindow->hSplitterPos)-2, dlgWidth-8, 4, SWP_NOZORDER); + EndDeferWindowPos(hdwp); + if (chatWindow->getHWNDLog()!=NULL) { + IEVIEWWINDOW ieWindow; + ieWindow.cbSize = sizeof(IEVIEWWINDOW); + ieWindow.iType = IEW_SETPOS; + ieWindow.parent = hwndDlg; + ieWindow.hwnd = chatWindow->getHWNDLog(); + ieWindow.x = 0; + ieWindow.y = 30; + ieWindow.cx = dlgWidth-(chatWindow->vSplitterPos)-2; + ieWindow.cy = dlgHeight-(chatWindow->hSplitterPos)-30-26-2; + CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow); + } + } + break; + /* + case WM_SYSCOMMAND: + if (wParam == SC_CLOSE) { + SendMessage(hwndDlg, WM_CLOSE, 1, 0); +// muce.iType = MUCC_EVENT_LEAVE; +// muce.pszModule = chatWindow->getModule(); +// muce.pszID = chatWindow->getRoomId(); +// NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce); +// delete chatWindow; + return TRUE; + } + break; + */ + case WM_CLOSE: + //if (wParam != 1) { // esc + //return FALSE; + //} + DestroyWindow(hwndDlg); + return TRUE; + case WM_DESTROY: + { + MUCCEVENT muce; + muce.cbSize = sizeof(MUCCEVENT); + muce.iType = MUCC_EVENT_LEAVE; + muce.pszModule = chatWindow->getModule(); + muce.pszID = chatWindow->getRoomId(); + NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce); + if (chatWindow->getHWNDLog()!=NULL) { + IEVIEWWINDOW ieWindow; + ieWindow.cbSize = sizeof(IEVIEWWINDOW); + ieWindow.iType = IEW_DESTROY; + ieWindow.hwnd = chatWindow->getHWNDLog(); + CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow); + } + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) NULL); + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_HSPLIT), GWLP_WNDPROC, (LONG_PTR) oldSplitterWndProc); + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_VSPLIT), GWLP_WNDPROC, (LONG_PTR) oldSplitterWndProc); + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EDIT), GWLP_WNDPROC, (LONG_PTR) oldEditWndProc); + delete chatWindow; + break; + } + case WM_TLEN_SMILEY: + if (ServiceExists(MS_SMILEYADD_REPLACESMILEYS)) { + SMADD_RICHEDIT2 smre; + smre.cbSize = sizeof(SMADD_RICHEDIT2); + smre.hwndRichEditControl = GetDlgItem(hwndDlg, IDC_LOG); + smre.Protocolname = (char *)chatWindow->getModule(); + smre.rangeToReplace = NULL; + smre.useSounds = FALSE; + smre.disableRedraw = FALSE; + CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM) &smre); + } + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_OPTIONS: + { + MUCCEVENT muce; + HMENU hMenu; + RECT rc; + int iSelection; + hMenu=GetSubMenu(LoadMenu(hInst, MAKEINTRESOURCE(IDR_CHATOPTIONS)),0); + CallService(MS_LANGPACK_TRANSLATEMENU,(WPARAM)hMenu,0); + GetWindowRect(GetDlgItem(hwndDlg, IDC_OPTIONS), &rc); + CheckMenuItem(hMenu, ID_OPTIONMENU_SHOWNICKNAMES, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_SHOW_NICKNAMES ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, ID_OPTIONMENU_MSGINNEWLINE, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_MSGINNEWLINE ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, ID_OPTIONMENU_SHOWDATE, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_SHOW_DATE ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, ID_OPTIONMENU_SHOWTIMESTAMP, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_SHOW_TIMESTAMP ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, ID_OPTIONMENU_SHOWSECONDS, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_SHOW_SECONDS ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, ID_OPTIONMENU_USELONGDATE, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_LONG_DATE ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, ID_OPTIONMENU_FORMATFONT, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_FORMAT_FONT ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, ID_OPTIONMENU_FORMATSIZE, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_FORMAT_SIZE ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, ID_OPTIONMENU_FORMATCOLOR, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_FORMAT_COLOR ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, ID_OPTIONMENU_FORMATSTYLE, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_FORMAT_STYLE ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, ID_OPTIONMENU_LOGMESSAGES, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_LOG_MESSAGES ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, ID_OPTIONMENU_LOGJOINED, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_LOG_JOINED ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, ID_OPTIONMENU_LOGLEFT, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_LOG_LEFT ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, ID_OPTIONMENU_LOGTOPIC, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_LOG_TOPIC ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, ID_OPTIONMENU_FLASHMESSAGES, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_FLASH_MESSAGES ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, ID_OPTIONMENU_FLASHJOINED, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_FLASH_JOINED ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, ID_OPTIONMENU_FLASHLEFT, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_FLASH_LEFT ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, ID_OPTIONMENU_FLASHTOPIC, MF_BYCOMMAND | chatWindow->getOptions()&ChatWindow::FLAG_FLASH_TOPIC ? MF_CHECKED : MF_UNCHECKED); + if (chatWindow->getMe()!=NULL) { + if (chatWindow->getMe()->getFlags() & (MUCC_EF_USER_OWNER | MUCC_EF_USER_ADMIN)) { + EnableMenuItem(hMenu, ID_ADMINMENU_ADMIN, MF_BYCOMMAND | MF_ENABLED); + EnableMenuItem(hMenu, ID_ADMINMENU_BROWSE, MF_BYCOMMAND | MF_ENABLED); + } + if (chatWindow->getMe()->getFlags() & MUCC_EF_USER_OWNER) { + EnableMenuItem(hMenu, ID_ADMINMENU_DESTROY, MF_BYCOMMAND | MF_ENABLED); + } + } + iSelection = TrackPopupMenu(hMenu, TPM_RETURNCMD | TPM_TOPALIGN | TPM_LEFTALIGN, rc.left, rc.bottom, 0, hwndDlg, NULL); + DestroyMenu(hMenu); + switch (iSelection) { + case ID_OPTIONMENU_SHOWNICKNAMES: + chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_SHOW_NICKNAMES); + break; + case ID_OPTIONMENU_MSGINNEWLINE: + chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_MSGINNEWLINE); + break; + case ID_OPTIONMENU_SHOWDATE: + chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_SHOW_DATE); + break; + case ID_OPTIONMENU_SHOWTIMESTAMP: + chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_SHOW_TIMESTAMP); + break; + case ID_OPTIONMENU_SHOWSECONDS: + chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_SHOW_SECONDS); + break; + case ID_OPTIONMENU_USELONGDATE: + chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_LONG_DATE); + break; + case ID_OPTIONMENU_FORMATFONT: + chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_FORMAT_FONT); + break; + case ID_OPTIONMENU_FORMATSIZE: + chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_FORMAT_SIZE); + break; + case ID_OPTIONMENU_FORMATCOLOR: + chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_FORMAT_COLOR); + break; + case ID_OPTIONMENU_FORMATSTYLE: + chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_FORMAT_STYLE); + break; + case ID_OPTIONMENU_LOGMESSAGES: + chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_LOG_MESSAGES); + break; + case ID_OPTIONMENU_LOGJOINED: + chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_LOG_JOINED); + break; + case ID_OPTIONMENU_LOGLEFT: + chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_LOG_LEFT); + break; + case ID_OPTIONMENU_LOGTOPIC: + chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_LOG_TOPIC); + break; + case ID_OPTIONMENU_FLASHMESSAGES: + chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_FLASH_MESSAGES); + break; + case ID_OPTIONMENU_FLASHJOINED: + chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_FLASH_JOINED); + break; + case ID_OPTIONMENU_FLASHLEFT: + chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_FLASH_LEFT); + break; + case ID_OPTIONMENU_FLASHTOPIC: + chatWindow->setOptions(chatWindow->getOptions()^ChatWindow::FLAG_FLASH_TOPIC); + break; + case ID_OPTIONMENU_SAVEDEFAULT: + Options::setChatWindowOptions(chatWindow->getOptions()); + Options::setChatWindowFont((int)SendDlgItemMessage(hwndDlg, IDC_FONT, CB_GETCURSEL, 0, 0)); + Options::setChatWindowFontSize((int)SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_GETCURSEL, 0, 0)); + Options::setChatWindowFontStyle( + (IsDlgButtonChecked(hwndDlg, IDC_BOLD) ? Font::BOLD : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_ITALIC) ? Font::ITALIC : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_UNDERLINE) ? Font::UNDERLINE : 0) + ); + Options::setChatWindowFontColor((COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLOR, CPM_GETCOLOUR,0,0)); + Options::saveSettings(); + break; + case ID_ADMINMENU_DESTROY: + muce.cbSize = sizeof(MUCCEVENT); + muce.iType = MUCC_EVENT_REMOVE_ROOM; + muce.pszModule = chatWindow->getModule(); + muce.pszID = chatWindow->getRoomId(); + NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce); + DestroyWindow(hwndDlg); + break; + case ID_ADMINMENU_ADMIN: + chatWindow->startAdminDialog(ChatWindow::ADMIN_MODE_KICK); + break; + case ID_ADMINMENU_BROWSE: + chatWindow->startAdminDialog(ChatWindow::ADMIN_MODE_ROLE); + break; + case ID_ADMINMENU_SAVELOG: + if (chatWindow->getHWNDLog()!=NULL) { + IEVIEWEVENT iee; + ZeroMemory(&iee, sizeof(iee)); + iee.cbSize = sizeof(iee); + iee.dwFlags = 0; + iee.hwnd = chatWindow->getHWNDLog(); + iee.hContact = NULL; + iee.iType = IEE_SAVE_DOCUMENT; + CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&iee); + } else { + char szFilename[MAX_PATH]; + strcpy(szFilename, ""); + OPENFILENAMEA ofn={0}; + ofn.lStructSize=sizeof(OPENFILENAME); + ofn.hwndOwner=hwndDlg; + ofn.lpstrFile = szFilename; + ofn.lpstrFilter = "Rich Text File\0*.rtf\0\0"; + ofn.nMaxFile = MAX_PATH; + ofn.nMaxFileTitle = MAX_PATH; + ofn.Flags = OFN_HIDEREADONLY; + ofn.lpstrDefExt = "rtf"; + if (GetSaveFileNameA(&ofn)) { + //remove(szFilename); + EDITSTREAM stream = { 0 }; + stream.dwCookie = (DWORD_PTR)szFilename; + stream.dwError = 0; + stream.pfnCallback = EditStreamCallback; + SendDlgItemMessage(hwndDlg, IDC_LOG, EM_STREAMOUT, SF_RTF | SF_USECODEPAGE, (LPARAM) & stream); + } + } + break; + } + } + break; + case IDC_SMILEYBTN: + SMADD_SHOWSEL smaddInfo; + RECT rc; + smaddInfo.cbSize = sizeof(SMADD_SHOWSEL); + smaddInfo.hwndTarget = GetDlgItem(hwndDlg, IDC_EDIT); + smaddInfo.targetMessage = EM_REPLACESEL; + smaddInfo.targetWParam = TRUE; + smaddInfo.Protocolname = chatWindow->getModule(); + GetWindowRect(GetDlgItem(hwndDlg, IDC_SMILEYBTN), &rc); + smaddInfo.Direction = 0; + smaddInfo.xPosition = rc.left; + smaddInfo.yPosition = rc.top + 24; + if (chatWindow->getHWNDLog() != NULL) { + CallService(MS_IEVIEW_SHOWSMILEYSELECTION, 0, (LPARAM) &smaddInfo); + } else { + CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM) &smaddInfo); + } + break; + case IDC_INVITE: + { + MUCCEVENT muce; + muce.cbSize = sizeof(MUCCEVENT); + muce.iType = MUCC_EVENT_QUERY_CONTACTS; + muce.pszModule = chatWindow->getModule(); + muce.pszID = chatWindow->getRoomId(); + NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce); + } + break; + case IDC_TOPIC_BUTTON: + HelperDialog::topicDlg(chatWindow); + break; + case IDCANCEL: + DestroyWindow(hwndDlg); + return TRUE; + case IDOK: + { + MUCCEVENT muce; + char text[2048]; + GetDlgItemTextA(hwndDlg, IDC_EDIT, text, sizeof(text)); + SetDlgItemTextA(hwndDlg, IDC_EDIT, ""); + muce.cbSize = sizeof(MUCCEVENT); + muce.iType = MUCC_EVENT_MESSAGE; + muce.pszModule = chatWindow->getModule(); + muce.pszID = chatWindow->getRoomId(); + muce.pszText = text; + muce.iFont = chatWindow->getFont(); + muce.iFontSize = chatWindow->getFontSize(); + muce.dwFlags = chatWindow->getFontStyle(); + muce.color = chatWindow->getFontColor(); + NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce); + } + break; + case IDC_BOLD: + case IDC_ITALIC: + case IDC_UNDERLINE: + if (HIWORD(wParam)==BN_CLICKED) { + chatWindow->setFont((int) SendDlgItemMessage(hwndDlg, IDC_FONT, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_FONT, CB_GETCURSEL, 0, 0), 0), + (int) SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_GETCURSEL, 0, 0), 0), + IsDlgButtonChecked(hwndDlg, IDC_BOLD), + IsDlgButtonChecked(hwndDlg, IDC_ITALIC), + IsDlgButtonChecked(hwndDlg, IDC_UNDERLINE), + (COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLOR, CPM_GETCOLOUR,0,0)); + } + case IDC_FONT: + case IDC_FONTSIZE: + if (HIWORD(wParam)==CBN_SELCHANGE) { + chatWindow->setFont((int) SendDlgItemMessage(hwndDlg, IDC_FONT, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_FONT, CB_GETCURSEL, 0, 0), 0), + (int) SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_GETCURSEL, 0, 0), 0), + IsDlgButtonChecked(hwndDlg, IDC_BOLD), + IsDlgButtonChecked(hwndDlg, IDC_ITALIC), + IsDlgButtonChecked(hwndDlg, IDC_UNDERLINE), + (COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLOR, CPM_GETCOLOUR,0,0)); + } + break; + case IDC_COLOR: + if (HIWORD(wParam)==CPN_COLOURCHANGED) { + InvalidateRect(GetDlgItem(hwndDlg, IDC_EDIT), NULL, FALSE); + chatWindow->setFont((int) SendDlgItemMessage(hwndDlg, IDC_FONT, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_FONT, CB_GETCURSEL, 0, 0), 0), + (int) SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_GETCURSEL, 0, 0), 0), + IsDlgButtonChecked(hwndDlg, IDC_BOLD), + IsDlgButtonChecked(hwndDlg, IDC_ITALIC), + IsDlgButtonChecked(hwndDlg, IDC_UNDERLINE), + (COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLOR, CPM_GETCOLOUR,0,0)); + } + break; + + } + break; + case WM_CTLCOLOREDIT: + if ((HWND) lParam == GetDlgItem(hwndDlg, IDC_EDIT)) { + SetTextColor((HDC) wParam, (COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLOR, CPM_GETCOLOUR,0,0)); + SetBkColor((HDC) wParam, Options::getInputBgColor()); + //SelectObject((HDC) wParam, Options::getInputBgBrush()); + return (BOOL) Options::getInputBgBrush(); + } + + break; + case WM_NOTIFY: + LPNMHDR pNmhdr; + pNmhdr = (LPNMHDR)lParam; + if (pNmhdr->idFrom == IDC_TREELIST) { + switch (pNmhdr->code) { + case TVN_ITEMEXPANDING: + { + LPNMTREEVIEW pnmtv = (LPNMTREEVIEW) lParam; + if (pnmtv->action==TVE_COLLAPSE) { + SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT, TRUE); + return TRUE; + } + } + break; + case NM_RCLICK: + { + TVHITTESTINFO hti; + hti.pt.x=(short)LOWORD(GetMessagePos()); + hti.pt.y=(short)HIWORD(GetMessagePos()); + ScreenToClient(pNmhdr->hwndFrom,&hti.pt); + if(TreeView_HitTest(pNmhdr->hwndFrom, &hti) && hti.flags&TVHT_ONITEM) { + TVITEM tvi = {0}; + tvi.mask = TVIF_PARAM|TVIF_HANDLE; + tvi.hItem = hti.hItem; + TreeView_GetItem(pNmhdr->hwndFrom, &tvi); + ChatUser *user = (ChatUser *) tvi.lParam; + if (user!=NULL) { + TreeView_Select(pNmhdr->hwndFrom, tvi.hItem, TVGN_CARET); + if (!user->isMe()) { + HMENU hMenu; + int iSelection; + hMenu = GetSubMenu(LoadMenu(hInst, MAKEINTRESOURCE(IDR_CHATOPTIONS)),1); + CallService(MS_LANGPACK_TRANSLATEMENU,(WPARAM)hMenu,0); + if (chatWindow->getMe()!=NULL) { + if (chatWindow->getMe()->getFlags() & MUCC_EF_USER_OWNER) { + EnableMenuItem(hMenu, 2, MF_BYPOSITION | MF_ENABLED); + EnableMenuItem(hMenu, 3, MF_BYPOSITION | MF_ENABLED); + EnableMenuItem(hMenu, ID_USERMENU_ADMINISTRATION, MF_BYCOMMAND | MF_ENABLED); + + } else if (chatWindow->getMe()->getFlags() & MUCC_EF_USER_ADMIN) { + if (!(user->getFlags() & (MUCC_EF_USER_OWNER | MUCC_EF_USER_OWNER))) { + EnableMenuItem(hMenu, 2, MF_BYPOSITION | MF_ENABLED); + //EnableMenuItem(hMenu, 3, MF_BYPOSITION | MF_ENABLED); + EnableMenuItem(hMenu, ID_USERMENU_ADMINISTRATION, MF_BYCOMMAND | MF_ENABLED); + } + } + } + //CheckMenuItem(hMenu, ID_USERMENU_MESSAGE, MF_BYCOMMAND | MF_CHECKED : MF_UNCHECKED); + //EnableMenuItem(hMenu, ID_USERMENU_MESSAGE, MF_BYCOMMAND | MF_GRAYED); + iSelection = TrackPopupMenu(hMenu, TPM_RETURNCMD | TPM_TOPALIGN | TPM_LEFTALIGN, (short)LOWORD(GetMessagePos()), (short)HIWORD(GetMessagePos()), 0, hwndDlg, NULL); + DestroyMenu(hMenu); + if (iSelection == ID_USERMENU_MESSAGE) { + chatWindow->startPriv(); + } else if (iSelection >= ID_USERMENU_KICK_NO_BAN && iSelection <= ID_USERMENU_KICK_BAN_4_W) { + int banTime[] = {0, 1, 5, 15, 30, 60, 360, 1440, 4320, 10080, 20160, 40320}; + chatWindow->kickAndBan(banTime[iSelection-ID_USERMENU_KICK_NO_BAN] *60); + } else if (iSelection == ID_USERMENU_RIGHTS_MEMBER) { + chatWindow->setRights(MUCC_EF_USER_MEMBER); + } else if (iSelection == ID_USERMENU_RIGHTS_ADMIN) { + chatWindow->setRights(MUCC_EF_USER_ADMIN); + } else if (iSelection == ID_USERMENU_RIGHTS_NO) { + chatWindow->setRights(0); + } else if (iSelection == ID_USERMENU_ADMINISTRATION) { + chatWindow->startAdminDialog(ChatWindow::ADMIN_MODE_KICK); + } + } + } + } + + } + break; + case NM_CUSTOMDRAW: + LPNMTVCUSTOMDRAW pCustomDraw = (LPNMTVCUSTOMDRAW)lParam; + switch (pCustomDraw->nmcd.dwDrawStage) { + case CDDS_PREPAINT: + SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,CDRF_NOTIFYITEMDRAW); + return TRUE; + case CDDS_ITEMPREPAINT: + { + TVITEM tvi;; + HICON hIcon; + TCHAR str[200]; + RECT rc = pCustomDraw->nmcd.rc; + tvi.mask = TVIF_HANDLE | TVIF_STATE | TVIF_TEXT | TVIF_PARAM; + tvi.pszText = str; + tvi.cchTextMax = sizeof(str)/sizeof(TCHAR); + tvi.hItem = (HTREEITEM)pCustomDraw->nmcd.dwItemSpec; + TreeView_GetItem(pCustomDraw->nmcd.hdr.hwndFrom, &tvi); + ChatUser * user= (ChatUser *)pCustomDraw->nmcd.lItemlParam; + hIcon = NULL; + pCustomDraw->clrTextBk = Options::getListBgColor(); + switch (pCustomDraw->iLevel) { + case 0: + pCustomDraw->clrText = ChatWindow::getListGroupTextColor(); + SelectObject(pCustomDraw->nmcd.hdc, ChatWindow::getListGroupFont()); + break; + case 1: + pCustomDraw->clrText = ChatWindow::getListTextColor(); + if (pCustomDraw->nmcd.uItemState & CDIS_SELECTED) { // selected (CDIS_FOCUS | + pCustomDraw->clrTextBk = 0xDAC8C2; + } else { + pCustomDraw->clrTextBk = Options::getListBgColor(); + } + if (user!=NULL) { + if (user->getFlags()&MUCC_EF_USER_GLOBALOWNER) { + hIcon = muccIcon[MUCC_IDI_U_GLOBALOWNER]; + } else if (user->getFlags()&MUCC_EF_USER_OWNER) { + hIcon = muccIcon[MUCC_IDI_U_OWNER]; + } else if (user->getFlags()&MUCC_EF_USER_ADMIN) { + hIcon = muccIcon[MUCC_IDI_U_ADMIN]; + } else if (user->getFlags()&MUCC_EF_USER_REGISTERED) { + hIcon = muccIcon[MUCC_IDI_U_REGISTERED]; + } + } + SelectObject(pCustomDraw->nmcd.hdc, ChatWindow::getListFont()); + break; + } + if (rc.bottom-rc.top!=0 && rc.right-rc.left!=0) { + HBRUSH hBr; + hBr = CreateSolidBrush(pCustomDraw->clrTextBk); + FillRect(pCustomDraw->nmcd.hdc, &rc, hBr); + DeleteObject(hBr); + if (hIcon!=NULL) { + DrawIconEx(pCustomDraw->nmcd.hdc, rc.left, rc.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL); + } + SetBkMode(pCustomDraw->nmcd.hdc, TRANSPARENT); + SetTextColor(pCustomDraw->nmcd.hdc, pCustomDraw->clrText); + TextOut(pCustomDraw->nmcd.hdc, + rc.left+pCustomDraw->iLevel*GetSystemMetrics(SM_CXSMICON)+2, + rc.top, tvi.pszText, (int)_tcslen(tvi.pszText)); + } + SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT, CDRF_SKIPDEFAULT ); + return TRUE; + } + } + break; + } + } else if (pNmhdr->idFrom == IDC_LOG) { + switch (((NMHDR *) lParam)->code) { + case EN_MSGFILTER: + switch (((MSGFILTER *) lParam)->msg) { + /* + case WM_LBUTTONDOWN: + { + HCURSOR hCur = GetCursor(); + if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE) + || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE)) { + SetWindowLong(hwndDlg, DWL_MSGRESULT, TRUE); + return TRUE; + } + break; + } + case WM_MOUSEMOVE: + { + HCURSOR hCur = GetCursor(); + if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE) + || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE)) + SetCursor(LoadCursor(NULL, IDC_ARROW)); + break; + } + */ + case WM_RBUTTONUP: + { + HMENU hMenu, hSubMenu; + POINT pt; + CHARRANGE sel, all = { 0, -1 }; + + hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT)); + hSubMenu = GetSubMenu(hMenu, 0); + CallService(MS_LANGPACK_TRANSLATEMENU, (WPARAM) hSubMenu, 0); + SendMessage(((NMHDR *) lParam)->hwndFrom, EM_EXGETSEL, 0, (LPARAM) & sel); + if (sel.cpMin == sel.cpMax) + EnableMenuItem(hSubMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED); + pt.x = (short) LOWORD(((ENLINK *) lParam)->lParam); + pt.y = (short) HIWORD(((ENLINK *) lParam)->lParam); + ClientToScreen(((NMHDR *) lParam)->hwndFrom, &pt); + switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) { + case IDM_COPY: + SendMessage(((NMHDR *) lParam)->hwndFrom, WM_COPY, 0, 0); + break; + case IDM_COPYALL: + SendMessage(((NMHDR *) lParam)->hwndFrom, EM_EXSETSEL, 0, (LPARAM) & all); + SendMessage(((NMHDR *) lParam)->hwndFrom, WM_COPY, 0, 0); + SendMessage(((NMHDR *) lParam)->hwndFrom, EM_EXSETSEL, 0, (LPARAM) & sel); + break; + case IDM_SELECTALL: + SendMessage(((NMHDR *) lParam)->hwndFrom, EM_EXSETSEL, 0, (LPARAM) & all); + break; + case IDM_CLEAR: + chatWindow->clearLog(); + break; + } + DestroyMenu(hMenu); + SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE); + return TRUE; + } + } + break; + case EN_LINK: + switch (((ENLINK *) lParam)->msg) { + case WM_SETCURSOR: + SetCursor(hCurHyperlinkHand); + SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE); + return TRUE; + case WM_RBUTTONDOWN: + case WM_LBUTTONUP: + { + TEXTRANGEA tr; + CHARRANGE sel; + + SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXGETSEL, 0, (LPARAM) & sel); + if (sel.cpMin != sel.cpMax) + break; + tr.chrg = ((ENLINK *) lParam)->chrg; + tr.lpstrText = (char *)malloc(tr.chrg.cpMax - tr.chrg.cpMin + 8); + SendDlgItemMessageA(hwndDlg, IDC_LOG, EM_GETTEXTRANGE, 0, (LPARAM) & tr); + if (strchr(tr.lpstrText, '@') != NULL && strchr(tr.lpstrText, ':') == NULL && strchr(tr.lpstrText, '/') == NULL) { + MoveMemory(tr.lpstrText + 7, tr.lpstrText, tr.chrg.cpMax - tr.chrg.cpMin + 1); + CopyMemory(tr.lpstrText, "mailto:", 7); + } + if (((ENLINK *) lParam)->msg == WM_RBUTTONDOWN) { + HMENU hMenu, hSubMenu; + POINT pt; + + hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT)); + hSubMenu = GetSubMenu(hMenu, 1); + CallService(MS_LANGPACK_TRANSLATEMENU, (WPARAM) hSubMenu, 0); + pt.x = (short) LOWORD(((ENLINK *) lParam)->lParam); + pt.y = (short) HIWORD(((ENLINK *) lParam)->lParam); + ClientToScreen(((NMHDR *) lParam)->hwndFrom, &pt); + switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) { + case IDM_OPENNEW: + CallService(MS_UTILS_OPENURL, 1, (LPARAM) tr.lpstrText); + break; + case IDM_OPENEXISTING: + CallService(MS_UTILS_OPENURL, 0, (LPARAM) tr.lpstrText); + break; + case IDM_COPYLINK: + { + HGLOBAL hData; + if (!OpenClipboard(hwndDlg)) + break; + EmptyClipboard(); + hData = GlobalAlloc(GMEM_MOVEABLE, lstrlenA(tr.lpstrText) + 1); + lstrcpyA((char *)GlobalLock(hData), tr.lpstrText); + GlobalUnlock(hData); + SetClipboardData(CF_TEXT, hData); + CloseClipboard(); + break; + } + } + free(tr.lpstrText); + DestroyMenu(hMenu); + SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE); + return TRUE; + } + else { + CallService(MS_UTILS_OPENURL, 1, (LPARAM) tr.lpstrText); + SetFocus(GetDlgItem(hwndDlg, IDC_EDIT)); + } + free(tr.lpstrText); + break; + } + } + break; + } + } + break; + } + return FALSE; +} + +static char *JabberRtfEscape(char *str) { + char *escapedStr; + int size; + char *p, *q; + + if (str == NULL) + return NULL; + + for (p=str,size=0; *p!='\0'; p++) { + if (*p=='\\' || *p=='{' || *p=='}') + size += 2; + else if (*p=='\n' || *p=='\t') + size += 5; + else + size++; + } + + if ((escapedStr=(char *)malloc(size+1)) == NULL) + return NULL; + + for (p=str,q=escapedStr; *p!='\0'; p++) { + if (strchr("\\{}", *p) != NULL) { + *q++ = '\\'; + *q++ = *p; + } + else if (*p == '\n') { + strcpy(q, "\\par "); + q += 5; + } + else if (*p == '\t') { + strcpy(q, "\\tab "); + q += 5; + } + else { + *q++ = *p; + } + } + *q = '\0'; + + return escapedStr; +} + +static void JabberStringAppend(char **str, int *sizeAlloced, const char *fmt, ...) { + va_list vararg; + char *p; + int size, len; + + if (str == NULL) return; + + if (*str==NULL || *sizeAlloced<=0) { + *sizeAlloced = size = 2048; + *str = (char *) malloc(size); + len = 0; + } + else { + len = (int)strlen(*str); + size = *sizeAlloced - (int)strlen(*str); + } + + p = *str + len; + va_start(vararg, fmt); + while (_vsnprintf(p, size, fmt, vararg) == -1) { + size += 2048; + (*sizeAlloced) += 2048; + *str = (char *) realloc(*str, *sizeAlloced); + p = *str + len; + } + va_end(vararg); +} + + +//static DWORD CALLBACK Log_StreamCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb) +//{ +// StreamData *stream = (StreamData *) dwCookie; +/* + if (lstrdat->buffer == NULL) + { + lstrdat->iColCount = 4; + lstrdat->bufferOffset = 0; + lstrdat->buffer = Log_CreateBody(lstrdat); + lstrdat->bufferLen = lstrlen(lstrdat->buffer); + } + *pcb = min(cb, lstrdat->bufferLen - lstrdat->bufferOffset); + CopyMemory(pbBuff, lstrdat->buffer + lstrdat->bufferOffset, *pcb); + lstrdat->bufferOffset += *pcb; + if (lstrdat->bufferOffset == lstrdat->bufferLen) + { + free(lstrdat->buffer); + lstrdat->buffer = NULL; + } +*/ +// return 0; +//} diff --git a/!NotAdopted/Tlen/tlen_czaty/ChatWindow.h b/!NotAdopted/Tlen/tlen_czaty/ChatWindow.h new file mode 100644 index 0000000000..37b0b29d6e --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/ChatWindow.h @@ -0,0 +1,196 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +class ChatWindow; + +#ifndef CHATWINDOW_INCLUDED +#define CHATWINDOW_INCLUDED +#include "mucc.h" +#include "ChatEvent.h" +#include "ChatUser.h" +#include "AdminWindow.h" +#include "ChatContainer.h" + +#define DM_CHAT_EVENT (WM_USER+1) +#define DM_CHAT_QUERY (WM_USER+2) +#define WM_TLEN_SMILEY (WM_USER+200) + + +class StreamData { +public: + ChatWindow *chat; + MUCCEVENT *event; +}; + +class ChatWindow{ +private: + static ChatWindow * list; + static CRITICAL_SECTION mutex; + static bool released; + static HFONT hListGroupFont, hListFont; + static COLORREF colorListBg, colorListText, colorListGroupText; + static COLORREF colorInputBg, colorLogBg; + ChatContainer * container; + HANDLE hEvent; + HWND hWnd; + HWND hWndLog; + HFONT hEditFont; + HTREEITEM hUserGroups[5]; + char * module; + char * roomId; + char * roomName; + char * topic; + int options; + int roomFlags; + int font, fontSize; + int bBold, bItalic, bUnderline; + int wasFirstMessage; + bool isEmpty; + COLORREF fontColor; + int isStarted; + ChatWindow * prev; + ChatWindow * next; + int adminDialogMode; + AdminWindow * adminWindow; + ChatUser * users; + ChatUser * userMe; + void addUser(ChatUser *); + void removeUser(ChatUser *); + ChatUser * findUser(const char *); + int getUserGroup(ChatUser *); + ChatUser * getSelectedUser(); + ChatEventList eventList; + void createRTFHeader(); + int appendMessage(const MUCCEVENT *event); + int logMessage(const MUCCEVENT *event); +public: + enum LOGFLAGS { + FLAG_SHOW_NICKNAMES = 0x00000001, + FLAG_MSGINNEWLINE = 0x00000002, + FLAG_OPT_SENDONENTER= 0x00000004, + FLAG_OPT_ENABLEIEVIEW=0x00000008, + + FLAG_SHOW_DATE = 0x00000010, + FLAG_SHOW_TIMESTAMP = 0x00000020, + FLAG_SHOW_SECONDS = 0x00000040, + FLAG_LONG_DATE = 0x00000080, + + FLAG_FORMAT_FONT = 0x00000100, + FLAG_FORMAT_SIZE = 0x00000200, + FLAG_FORMAT_COLOR = 0x00000400, + FLAG_FORMAT_STYLE = 0x00000800, + FLAG_FORMAT_ALL = 0x00000F00, + + FLAG_LOG_MESSAGES = 0x00001000, + FLAG_LOG_JOINED = 0x00002000, + FLAG_LOG_LEFT = 0x00004000, + FLAG_LOG_TOPIC = 0x00008000, + FLAG_LOG_ALL = 0x0000F000, + + FLAG_FLASH_MESSAGES = 0x00010000, + FLAG_FLASH_JOINED = 0x00020000, + FLAG_FLASH_LEFT = 0x00040000, + FLAG_FLASH_TOPIC = 0x00080000, + FLAG_FLASH_ALL = 0x000F0000, + + + }; + + enum ADMINMODES { + ADMIN_MODE_KICK = 1, + ADMIN_MODE_ROLE = 2, + ADMIN_MODE_BROWSER = 3 + }; + int hSplitterPos; + int vSplitterPos; + int hSplitterMinBottom; + int hSplitterMinTop; + int vSplitterMinLeft; + int vSplitterMinRight; + ChatWindow (MUCCWINDOW *); + ~ChatWindow (); + ChatWindow * getNext(); + void setNext(ChatWindow *); + ChatWindow * getPrev(); + ChatContainer* getContainer(); + void setPrev(ChatWindow *); + void setHWND(HWND); + HWND getHWND(); + void setHWNDLog(HWND); + HWND getHWNDLog(); + HANDLE getEvent(); + const char * getModule(); + void setModule(const char *); + const char * getRoomId(); + void setRoomId(const char *); + const char * getRoomName(); + void setRoomName(const char *); + void setOptions(int); + int getOptions(); + void setRoomFlags(int); + int getRoomFlags(); + int getFontSizeNum(); + int getFontSize(int); + int getFontNameNum(); + const char * getFontName(int); + void setFont(int font, int size, int bBold, int bItalic, int bUnderline, COLORREF color); + int getFont(); + int getFontSize(); + int getFontStyle(); + COLORREF getFontColor(); + int start(); + int startPriv(); + void startAdminDialog(int mode); + int kickAndBan(int time); + int kickAndBan(const char *id, int time, const char *); + int unban(const char *id); + int setRights(int flags); + int setRights(const char *id, int flags); + void queryResultContacts(MUCCQUERYRESULT *queryResult); + void queryResultUsers(MUCCQUERYRESULT *queryResult); + void setTreeItem(int, HTREEITEM); + HTREEITEM getTreeItem(int); + ChatUser * findUserByNick(const char *); + ChatUser * getMe(); + void refreshSettings(); + void setAdminWindow(AdminWindow *); + AdminWindow * getAdminWindow(); + void rebuildLog(); + void clearLog(); + int logEvent(const MUCCEVENT *event); + int changePresence(const MUCCEVENT *event); + int changeTopic(const MUCCEVENT *event); + int changeRoomInfo(const MUCCEVENT *event); + int leave(); + + static void refreshSettings(int force); + static HFONT getListGroupFont(); + static HFONT getListFont(); + static COLORREF getListTextColor(); + static COLORREF getListGroupTextColor(); + static int getDefaultOptions(); + + static void init(); + static void release(); + static ChatWindow * getWindow(const char *module, const char *roomId); + +}; +#endif diff --git a/!NotAdopted/Tlen/tlen_czaty/FontList.cpp b/!NotAdopted/Tlen/tlen_czaty/FontList.cpp new file mode 100644 index 0000000000..4d57617013 --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/FontList.cpp @@ -0,0 +1,206 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +#include "FontList.h" +#include "Utils.h" + +#define FONTCOUNT 12 +static Font defFonts[] = { + Font("Timestamp","Verdana", DEFAULT_CHARSET, -9, Font::BOLD, 0x000000), +// Font("Colon","Verdana", DEFAULT_CHARSET, -13, 0, 0x808080), + Font("Others names","Verdana", DEFAULT_CHARSET, -13, 0, 0x723732), + Font("Your name","Verdana", DEFAULT_CHARSET, -13, 0, 0x4453A4), + Font("Incoming message","Verdana", DEFAULT_CHARSET, -13, 0, 0x000000), + Font("Outgoing message","Verdana", DEFAULT_CHARSET, -13, 0, 0x505080), + Font("User has joined","Verdana", DEFAULT_CHARSET, -11, Font::ITALIC, 0x0F880F), + Font("User has left","Verdana", DEFAULT_CHARSET, -11, Font::ITALIC, 0x1313B9), + Font("The topic is ...","Verdana", DEFAULT_CHARSET, -13, Font::ITALIC, 0x991A53), + Font("Error","Verdana", DEFAULT_CHARSET, -13, Font::BOLD, 0x1010D0), + Font("Message typing area","Verdana", DEFAULT_CHARSET, -13, 0, 0x000000), + Font("User list","Tahoma", DEFAULT_CHARSET, -11, 0, 0x000000), + Font("User list group","Tahoma", DEFAULT_CHARSET, -11, Font::BOLD, 0x000000) + +}; + +Font::Font() { + name = NULL; + face = NULL; + size = 0; + style = 0; + color = 0; + charSet = DEFAULT_CHARSET; +} + +Font::Font(const char *n, const char *f, int cs, int s, int st, COLORREF c) { + name = NULL; + face = NULL; + size = 0; + style = 0; + color = 0; + setName(n); + setFace(f); + setCharSet(cs); + setSize(s); + setStyle(st); + setColor(c); +} + + +COLORREF Font::getColor() { + return color; +} + +void Font::setColor(COLORREF c) { + color = c; +} + +int Font::getSize() { + return size; +} + +void Font::setSize(int s) { + size = s; +} + +int Font::getStyle() { + return style; +} + +void Font::setStyle(int s) { + style = s; +} + +int Font::getCharSet() { + return charSet; +} + +void Font::setCharSet(int s) { + charSet = s; +} + +void Font::setName(const char *s) { + Utils::copyString(&name, s); +} + +const char *Font::getName() { + return name; +} + +void Font::setFace(const char *s) { + Utils::copyString(&face, s); +} + +const char *Font::getFace() { + return face; +} + +Font *FontList::fonts = NULL; +Font *FontList::fontsSettings = NULL; + +Font *FontList::getFont(int index) { + if (index < FONTCOUNT) return &fonts[index]; + else return NULL; +} + +Font *FontList::getFontSettings(int index) { + if (index < FONTCOUNT) return &fontsSettings[index]; + else return NULL; +} + +void FontList::loadSettings() { + char fontParam[512]; + for (int i=0;iid = NULL; + this->name = NULL; + next = NULL; + Utils::copyString(&this->id, id); + Utils::copyString(&this->name, name); +} +HelperDialog::HelperContact::~HelperContact() { + if (id != NULL) delete id; + if (name != NULL) delete name; +} + +void HelperDialog::HelperContact::setNext(HelperContact *next) { + this->next = next; +} + +const char *HelperDialog::HelperContact::getId() { + return id; +} + +const char *HelperDialog::HelperContact::getName() { + return name; +} + +HelperDialog::HelperContact* HelperDialog::HelperContact::getNext() { + return next; +} + +void HelperDialog::init() { + InitializeCriticalSection(&mutex); +} + +void HelperDialog::release() { + while (list!=NULL) { + delete list; + } + DeleteCriticalSection(&mutex); +} + +HelperDialog::HelperDialog() { + module = nick = reason = roomId = roomName = NULL; + prev = next = NULL; + contactList = NULL; + hWnd = NULL; + hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + EnterCriticalSection(&mutex); + setNext(list); + if (next!=NULL) { + next->setPrev(this); + } + list = this; + LeaveCriticalSection(&mutex); +} + +HelperDialog::HelperDialog(ChatWindow *chat) { + module = nick = reason = roomId = roomName = NULL; + prev = next = NULL; + contactList = NULL; + hWnd = NULL; + hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + setModule(chat->getModule()); + setRoomId(chat->getRoomId()); + setRoomName(chat->getRoomName()); + setRoomFlags(chat->getRoomFlags()); + EnterCriticalSection(&mutex); + setNext(list); + if (next!=NULL) { + next->setPrev(this); + } + list = this; + LeaveCriticalSection(&mutex); +} + +HelperDialog::~HelperDialog() +{ + EnterCriticalSection(&mutex); + if (getPrev()!=NULL) { + getPrev()->setNext(next); + } else { + list = getNext(); + } + if (getNext()!=NULL) { + getNext()->setPrev(prev); + } + LeaveCriticalSection(&mutex); + if (hEvent!=NULL) CloseHandle(hEvent); + if (module!=NULL) delete module; + if (roomId!=NULL) delete roomId; + if (roomName!=NULL) delete roomName; + if (nick!=NULL) delete nick; + if (reason!=NULL) delete reason; + for (HelperContact *ptr2, *ptr=contactList;ptr!=NULL;ptr=ptr2) { + ptr2 = ptr->getNext(); + delete ptr; + } +} +void HelperDialog::setHWND(HWND hWnd) { + this->hWnd = hWnd; +} +HWND HelperDialog::getHWND() { + return hWnd; +} +void HelperDialog::setPrev(HelperDialog *prev) { + this->prev = prev; +} +void HelperDialog::setNext(HelperDialog *next) { + this->next = next; +} +HelperDialog * HelperDialog::getPrev() { + return prev; +} +HelperDialog * HelperDialog::getNext() { + return next; +} +const char *HelperDialog::getModule() +{ + return module; +} +const char *HelperDialog::getRoomId() +{ + return roomId; +} +const char *HelperDialog::getRoomName() +{ + return roomName; +} +const char *HelperDialog::getNick() +{ + return nick; +} +const char *HelperDialog::getReason() +{ + return reason; +} +void HelperDialog::setModule(const char *module) +{ + Utils::copyString(&this->module, module); +} +void HelperDialog::setRoomId(const char *roomId) +{ + Utils::copyString(&this->roomId, roomId); +} +void HelperDialog::setRoomName(const char *roomName) +{ + Utils::copyString(&this->roomName, roomName); +} +void HelperDialog::setNick(const char *nick) +{ + Utils::copyString(&this->nick, nick); +} +void HelperDialog::setReason(const char *reason) +{ + Utils::copyString(&this->reason, reason); +} +void HelperDialog::setRoomFlags(DWORD flags) +{ + this->roomFlags = flags; +} +void HelperDialog::setContactList(MUCCQUERYRESULT *queryResult) { + HelperContact *ptr, *lastptr; + for (ptr=contactList;ptr!=NULL;ptr=ptr->getNext()) { + delete ptr; + } + contactList = NULL; + lastptr = NULL; + for (int i=0;iiItemsNum;i++) { + ptr = new HelperContact(queryResult->pItems[i].pszID, queryResult->pItems[i].pszName); + if (lastptr != NULL) { + lastptr->setNext(ptr); + } else { + contactList = ptr; + } + lastptr = ptr; + } +} + +HelperDialog::HelperContact * HelperDialog::getContactList() { + return contactList; +} + +DWORD HelperDialog::getRoomFlags() { + return roomFlags; +} + +void HelperDialog::inviteDlg(ChatWindow *chat, MUCCQUERYRESULT *queryResult) { + HelperDialog *dialog=new HelperDialog(chat); + dialog->setContactList(queryResult); + Utils::forkThread((void (__cdecl *)(void *))InviteDlgThread, 0, (void *) dialog); + //WaitForSingleObject(dialog->getEvent(), INFINITE); +} + +void HelperDialog::acceptDlg(MUCCEVENT *event) { + HelperDialog *dialog=new HelperDialog(); + dialog->setModule(event->pszModule); + dialog->setRoomId(event->pszID); + dialog->setRoomName(event->pszName); + dialog->setRoomFlags(event->dwFlags); + dialog->setNick(event->pszNick); + // dialog->setReason(event->pszText); + Utils::forkThread((void (__cdecl *)(void *))AcceptInvitationDlgThread, 0, (void *) dialog); +// WaitForSingleObject(hEvent, INFINITE); +} + +void HelperDialog::joinDlg(MUCCEVENT *event) { + HelperDialog *dialog=new HelperDialog(); + dialog->setModule(event->pszModule); + dialog->setRoomId(event->pszID); + dialog->setRoomName(event->pszName); + dialog->setRoomFlags(event->dwFlags); + dialog->setNick(event->pszNick); + Utils::forkThread((void (__cdecl *)(void *))JoinDlgThread, 0, (void *) dialog); + //WaitForSingleObject(dialog->getEvent(), INFINITE); +} + +void HelperDialog::errorDlg(MUCCEVENT *event) { + HelperDialog *dialog=new HelperDialog(); + dialog->setReason(event->pszText); + Utils::forkThread((void (__cdecl *)(void *))ErrorDlgThread, 0, (void *) dialog); + //WaitForSingleObject(dialog->getEvent(), INFINITE); +} + +void HelperDialog::topicDlg(ChatWindow *chat) +{ + HelperDialog *dialog=new HelperDialog(); + dialog->setModule(chat->getModule()); + dialog->setRoomId(chat->getRoomId()); + Utils::forkThread((void (__cdecl *)(void *))TopicDlgThread, 0, (void *) dialog); +} + +static void __cdecl InviteDlgThread(void *vDialog) +{ + DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_HELPER_INVITE), NULL, InviteDlgProc, (LPARAM) vDialog); +} + +static void __cdecl AcceptInvitationDlgThread(void *vDialog) +{ + DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_HELPER_INVITE_ACCEPT), NULL, AcceptInvitationDlgProc, (LPARAM) vDialog); +} + +static void __cdecl JoinDlgThread(void *vDialog) +{ + DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_HELPER_JOIN), NULL, JoinDlgProc, (LPARAM) vDialog); +} + +static void __cdecl TopicDlgThread(void *vDialog) +{ + DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_HELPER_TOPIC), NULL, TopicDlgProc, (LPARAM) vDialog); +} + +static INT_PTR CALLBACK InviteDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + char str[256]; + HelperDialog::HelperContact *contactList; + HelperDialog *dialog = (HelperDialog *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + switch (msg) { + case WM_INITDIALOG: + dialog = (HelperDialog *) lParam; + TranslateDialogDefault(hwndDlg); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) dialog); + dialog->setHWND(hwndDlg); + SendDlgItemMessage(hwndDlg, IDC_REASON, EM_SETREADONLY, (WPARAM)TRUE, 0); + for (contactList = dialog->getContactList();contactList!=NULL;contactList=contactList->getNext()) { + SendDlgItemMessage(hwndDlg, IDC_USER, CB_ADDSTRING, 0, (LPARAM)contactList->getName()); + } + return TRUE; + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_INVITE: + MUCCEVENT muce; + GetDlgItemTextA(hwndDlg, IDC_USER, str, 255); + if (strlen(str)>0) { + for (contactList = dialog->getContactList();contactList!=NULL;contactList=contactList->getNext()) { + if (!strcmp(str, contactList->getName())) { + dialog->setNick(contactList->getId()); + break; + } + } + if (contactList==NULL) { + dialog->setNick(str); + } + } + muce.iType = MUCC_EVENT_INVITE; + muce.pszModule = dialog->getModule(); + muce.pszID = dialog->getRoomId(); + muce.pszNick = dialog->getNick(); + NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce); + case IDCANCEL: + case IDCLOSE: + EndDialog(hwndDlg, 0); + return TRUE; + } + break; + case WM_CLOSE: + EndDialog(hwndDlg, 0); + break; + case WM_DESTROY: + delete dialog; + break; + } + return FALSE; +} + + + + +static INT_PTR CALLBACK AcceptInvitationDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + char str[256]; + HelperDialog *dialog; + dialog = (HelperDialog *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + switch (msg) { + case WM_INITDIALOG: + { + dialog = (HelperDialog *) lParam; + TranslateDialogDefault(hwndDlg); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) dialog); + dialog->setHWND(hwndDlg); + if (dialog->getNick() != NULL) { + SetDlgItemTextA(hwndDlg, IDC_FROM, dialog->getNick()); + } + if (dialog->getRoomName() != NULL) { + SetDlgItemTextA(hwndDlg, IDC_ROOM, dialog->getRoomName()); + } + if (dialog->getReason() != NULL) { + SetDlgItemTextA(hwndDlg, IDC_REASON, dialog->getReason()); + } + +// if (!DBGetContactSetting(NULL, jabberProtoName, "LoginName", &dbv)) { +// SetDlgItemText(hwndDlg, IDC_NICK, dbv.pszVal); +// DBFreeVariant(&dbv); +// } + + /* + SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) LoadIcon(hInst, MAKEINTRESOURCE(IDI_GROUP))); +*/ + } + return TRUE; + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_ACCEPT: + GetDlgItemTextA(hwndDlg, IDC_NICK, str, 255); + dialog->setNick(str); + MUCCEVENT muce; + muce.iType = MUCC_EVENT_JOIN; + muce.pszModule = dialog->getModule(); + muce.pszID = dialog->getRoomId(); + muce.pszName = dialog->getRoomName(); + muce.dwFlags = dialog->getRoomFlags(); + muce.pszNick = NULL; + if (strlen(dialog->getNick())>0) { + muce.pszNick = dialog->getNick(); + } else { + muce.pszNick = NULL; + } + NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce); + case IDCANCEL: + case IDCLOSE: + EndDialog(hwndDlg, 0); + return TRUE; + } + break; + case WM_CLOSE: + EndDialog(hwndDlg, 0); + break; + case WM_DESTROY: + delete dialog; + break; + } + + return FALSE; +} + + +static INT_PTR CALLBACK JoinDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + char str[256]; + HelperDialog *dialog; + dialog = (HelperDialog *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + switch (msg) { + case WM_INITDIALOG: + dialog = (HelperDialog *) lParam; + TranslateDialogDefault(hwndDlg); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) dialog); + dialog->setHWND(hwndDlg); + SetFocus(GetDlgItem(hwndDlg, IDOK)); + if (dialog->getRoomFlags() & MUCC_EF_ROOM_NAME) { + SetFocus(GetDlgItem(hwndDlg, IDC_ROOM)); + } else { + SendDlgItemMessage(hwndDlg, IDC_ROOM, EM_SETREADONLY, (WPARAM)TRUE, 0); + } + if (dialog->getRoomFlags() & MUCC_EF_ROOM_NICKNAMES) { + SetFocus(GetDlgItem(hwndDlg, IDC_NICK)); + } else { + SendDlgItemMessage(hwndDlg, IDC_NICK, EM_SETREADONLY, (WPARAM)TRUE, 0); + } + if (dialog->getRoomName()!=NULL) { + SetDlgItemTextA(hwndDlg, IDC_ROOM, dialog->getRoomName()); + } + if (dialog->getNick()!=NULL) { + SetDlgItemTextA(hwndDlg, IDC_NICK, dialog->getNick()); + } + return FALSE; + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDOK: + MUCCEVENT muce; + if (dialog->getRoomId()==NULL) { + GetDlgItemTextA(hwndDlg, IDC_ROOM, str, 255); + if (strlen(str)>0) { + //dialog->setRoomId(str); + dialog->setRoomName(str); + } + } + GetDlgItemTextA(hwndDlg, IDC_NICK, str, 255); + if (strlen(str)>0) { + dialog->setNick(str); + } else { + dialog->setNick(NULL); + } + muce.iType = MUCC_EVENT_JOIN; + muce.pszModule = dialog->getModule(); + muce.pszID = dialog->getRoomId(); + muce.pszName = dialog->getRoomName(); + muce.pszNick = dialog->getNick(); + muce.dwFlags = dialog->getRoomFlags(); + NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce); + case IDCANCEL: + EndDialog(hwndDlg, 0); + return TRUE; + } + break; + case WM_CLOSE: + EndDialog(hwndDlg, 0); + break; + case WM_DESTROY: + delete dialog; + break; + } + return FALSE; +} + +static void __cdecl ErrorDlgThread(void *vDialog) +{ + HelperDialog *dialog=(HelperDialog *)vDialog; + MessageBoxA(NULL, dialog->getReason(), Translate("Error"), MB_OK | MB_ICONERROR); + /* + int result = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_GROUPCHAT_JOIN), NULL, JoinDlgProc, (LPARAM) dialog); + if (result!=0) { + MUCCEVENT muce; + muce.iType = MUCC_EVENT_JOIN; + muce.pszModule = dialog->getModule(); + muce.pszID = dialog->getRoomId(); + muce.pszName = dialog->getRoomName(); + muce.pszNick = dialog->getNick(); + NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce); + } + */ + delete dialog; +} + +/* +static INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + char str[256]; + HelperDialog *dialog; + dialog = (HelperDialog *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + switch (msg) { + case WM_INITDIALOG: + dialog = (HelperDialog *) lParam; + TranslateDialogDefault(hwndDlg); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) dialog); + dialog->setHWND(hwndDlg); + SetFocus(GetDlgItem(hwndDlg, IDOK)); + if (dialog->getRoomName()!=NULL) { + SetDlgItemTextA(hwndDlg, IDC_ROOM, dialog->getRoomName()); + } + if (dialog->getNick()!=NULL) { + SetDlgItemTextA(hwndDlg, IDC_NICK, dialog->getNick()); + } + return FALSE; + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDOK: + if (dialog->getRoomId()==NULL) { + GetDlgItemTextA(hwndDlg, IDC_ROOM, str, 255); + if (strlen(str)>0) { + //dialog->setRoomId(str); + dialog->setRoomName(str); + } + } + GetDlgItemTextA(hwndDlg, IDC_NICK, str, 255); + if (strlen(str)>0) { + dialog->setNick(str); + } else { + dialog->setNick(NULL); + } + case IDCANCEL: + EndDialog(hwndDlg, 0); + return TRUE; + } + break; + case WM_CLOSE: + EndDialog(hwndDlg, 0); + break; + case WM_DESTROY: + delete dialog; + break; + } + return FALSE; +} +*/ + +static INT_PTR CALLBACK TopicDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + char str[256]; + HelperDialog *dialog; + dialog = (HelperDialog *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + switch (msg) { + case WM_INITDIALOG: + dialog = (HelperDialog *) lParam; + TranslateDialogDefault(hwndDlg); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) dialog); + dialog->setHWND(hwndDlg); + return FALSE; + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDOK: + MUCCEVENT muce; + GetDlgItemTextA(hwndDlg, IDC_TOPIC, str, 255); + dialog->setReason(str); + muce.cbSize = sizeof(MUCCEVENT); + muce.iType = MUCC_EVENT_TOPIC; + muce.pszID = dialog->getRoomId(); + muce.pszModule = dialog->getModule(); + muce.pszText = dialog->getReason(); + NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce); + case IDCANCEL: + EndDialog(hwndDlg, 0); + return TRUE; + } + break; + case WM_CLOSE: + EndDialog(hwndDlg, 0); + break; + case WM_DESTROY: + delete dialog; + break; + } + return FALSE; +} + diff --git a/!NotAdopted/Tlen/tlen_czaty/HelperDialog.h b/!NotAdopted/Tlen/tlen_czaty/HelperDialog.h new file mode 100644 index 0000000000..08f856c3a9 --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/HelperDialog.h @@ -0,0 +1,95 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +#ifndef DIALOGS_INCLUDED +#define DIALOGS_INCLUDED + +#include "mucc.h" +#include "m_mucc.h" +#include "ChatWindow.h" + + +class HelperDialog { +public: + class HelperContact { + private: + char *id; + char *name; + HelperContact *next; + public: + HelperContact(const char *id, const char *name); + ~HelperContact(); + void setNext(HelperContact *); + HelperContact* getNext(); + const char * getId(); + const char * getName(); + }; + +private: + static HelperDialog * list; + static CRITICAL_SECTION mutex; + char * module; + char * roomId; + char * roomName; + DWORD roomFlags; + HelperContact * contactList; + HelperDialog * prev; + HelperDialog * next; + char * nick; + char * reason; + HANDLE hEvent; + HWND hWnd; +public: + HelperDialog(); + HelperDialog(ChatWindow *); + ~HelperDialog(); + void setModule(const char *); + void setRoomId(const char *); + void setRoomName(const char *); + void setRoomFlags(DWORD); + void setNick(const char *); + void setReason(const char *); + void setPrev(HelperDialog *); + HelperDialog* getPrev(); + void setNext(HelperDialog *); + HelperDialog* getNext(); + HWND getHWND(); + void setHWND(HWND hWnd); + void setContactList(MUCCQUERYRESULT *queryResult); + HelperContact* getContactList(); + const char * getModule(); + const char * getRoomId(); + const char * getRoomName(); + DWORD getRoomFlags(); + const char * getNick(); + const char * getReason(); + HANDLE getEvent(); + static void init(); + static void release(); + static void inviteDlg(ChatWindow *chat, MUCCQUERYRESULT *queryResult); + static void acceptDlg(MUCCEVENT *event); + static void joinDlg(MUCCEVENT *event); + static void errorDlg(MUCCEVENT *event); + static void topicDlg(ChatWindow *chat); +}; + + + +#endif diff --git a/!NotAdopted/Tlen/tlen_czaty/ManagerWindow.cpp b/!NotAdopted/Tlen/tlen_czaty/ManagerWindow.cpp new file mode 100644 index 0000000000..a01caebc15 --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/ManagerWindow.cpp @@ -0,0 +1,1067 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +#include "ManagerWindow.h" +#include "Utils.h" +#include "HelperDialog.h" + +static INT_PTR CALLBACK ManagerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); +static INT_PTR CALLBACK ChatRoomsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); +static INT_PTR CALLBACK MyRoomsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); + +ManagerWindow * ManagerWindow::list = NULL; +bool ManagerWindow::released = false; +CRITICAL_SECTION ManagerWindow::mutex; + +void ManagerWindow::init() { + released = false; + InitializeCriticalSection(&mutex); +} + +void ManagerWindow::release() { + released = true; + for (ManagerWindow *ptr2, *ptr = list; ptr!=NULL; ptr=ptr2) { + ptr2 = ptr->getNext(); + delete ptr; +// SendMessage(ptr->getHWND(), WM_CLOSE, 0, 0); + } + DeleteCriticalSection(&mutex); +} + +ManagerWindow::ManagerWindow(const char *module) +{ + next = prev = NULL; + groups = NULL; + rooms = NULL; + myRooms = NULL; + currentGroup = NULL; + isStarted = 0; + currentTab = 0; + currentRoomsPage = 0; + lastRoomsPage = 0; + userNickList = userRoomList = 0; + this->module = NULL; + this->moduleName = NULL; + Utils::copyString(&this->module, module); + hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + EnterCriticalSection(&mutex); + setNext(list); + if (next!=NULL) { + next->setPrev(this); + } + list = this; + LeaveCriticalSection(&mutex); +} + +ManagerWindow::~ManagerWindow() +{ + if (!released) { + EnterCriticalSection(&mutex); + if (getPrev()!=NULL) { + getPrev()->setNext(next); + } else { + list = getNext(); + } + if (getNext()!=NULL) { + getNext()->setPrev(prev); + } + LeaveCriticalSection(&mutex); + } + if (hWnd!=NULL) { + EndDialog(hWnd, 0); + } + if (hEvent!=NULL) { + CloseHandle(hEvent); + } + while (groups!=NULL) { + ChatGroup *group = groups; + groups = groups->getListNext(); + delete group; + } + while (rooms!=NULL) { + ChatRoom *room = rooms; + rooms = rooms->getNext(); + delete room; + } + while (myRooms!=NULL) { + ChatRoom *room = myRooms; + myRooms = myRooms->getNext(); + delete room; + } + if (module!=NULL) { + delete module; + } + if (moduleName!=NULL) { + delete moduleName; + } +} +void ManagerWindow::setPrev(ManagerWindow *prev) +{ + this->prev = prev; +} +ManagerWindow * ManagerWindow::getPrev() +{ + return prev; +} +void ManagerWindow::setNext(ManagerWindow *next) +{ + this->next = next; +} +ManagerWindow * ManagerWindow::getNext() +{ + return next; +} +void ManagerWindow::setHWND(HWND h) +{ + hWnd=h; +} +HWND ManagerWindow::getHWND() +{ + return hWnd; +} +void ManagerWindow::setChatRoomsTabHWND(HWND h) +{ + hChatRoomsTabWnd=h; +} +HWND ManagerWindow::getChatRoomsTabHWND() +{ + return hChatRoomsTabWnd; +} +void ManagerWindow::setMyRoomsTabHWND(HWND h) +{ + hMyRoomsTabWnd=h; +} +HWND ManagerWindow::getMyRoomsTabHWND() +{ + return hMyRoomsTabWnd; +} +void ManagerWindow::setMyNicksTabHWND(HWND h) +{ + hMyNicksTabWnd=h; +} +HWND ManagerWindow::getMyNicksTabHWND() +{ + return hMyNicksTabWnd; +} +const char *ManagerWindow::getModule() +{ + return module; +} +const char *ManagerWindow::getModuleName() +{ + return moduleName; +} +void ManagerWindow::setModuleName(const char *moduleName) +{ + Utils::copyString(&this->moduleName, moduleName); +} +ChatGroup *ManagerWindow::getCurrentGroup() +{ + return currentGroup; +} +void ManagerWindow::setCurrentGroup(ChatGroup *group) +{ + currentGroup = group; +} +HANDLE ManagerWindow::getEvent() +{ + return hEvent; +} +int ManagerWindow::getCurrentTab() +{ + return currentTab; +} +void ManagerWindow::setCurrentRoomsPage(int currentRoomsPage) +{ + this->currentRoomsPage = currentRoomsPage; +} +int ManagerWindow::getCurrentRoomsPage() +{ + return currentRoomsPage; +} +void ManagerWindow::setCurrentTab(int currentTab) +{ + this->currentTab = currentTab; +} +void ManagerWindow::setLastRoomsPage(int lastRoomsPage) +{ + this->lastRoomsPage = lastRoomsPage; +} +int ManagerWindow::isLastRoomsPage() +{ + return lastRoomsPage; +} +int ManagerWindow::isUserNickListReceived() +{ + return userNickList; +} +int ManagerWindow::isUserRoomListReceived() +{ + return userRoomList; +} +static void __cdecl StartThread(void *vManager) +{ + OleInitialize(NULL); + DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CHATMANAGER), NULL, ManagerDlgProc, (LPARAM) vManager); + OleUninitialize(); +} +int ManagerWindow::start() +{ + if (isStarted) { + ShowWindow(hWnd, SW_SHOW); + return 0; + } + isStarted = 1; + Utils::forkThread((void (__cdecl *)(void *))StartThread, 0, (void *) this); + WaitForSingleObject(hEvent, INFINITE); + return 0; +} +void ManagerWindow::queryResultGroups(MUCCQUERYRESULT *queryResult) +{ + TVINSERTSTRUCT tvis; + ChatGroup * par = NULL; + ChatGroup * group; + if (queryResult->pszParent != NULL) { + par = findGroup(queryResult->pszParent); + if (par!=NULL) { + if (par->getChild()!=NULL) return; + } + } + for (int i=0; iiItemsNum; i++) { + group = new ChatGroup(); + group->setId(queryResult->pItems[i].pszID); + group->setName(queryResult->pItems[i].pszName); + if (par!=NULL) { + par->addChild(group); + //group->setParent(par); + tvis.hParent = par->getTreeItem(); + } else { + tvis.hParent = NULL; + } + tvis.hInsertAfter = TVI_SORT; + tvis.item.mask = TVIF_TEXT | TVIF_CHILDREN | TVIF_PARAM; + LPTSTR lps1 = Utils::mucc_mir_a2t(queryResult->pItems[i].pszName); + tvis.item.pszText = lps1; + tvis.item.cChildren = queryResult->pItems[i].iCount; + tvis.item.lParam = (LPARAM) group; + group->setTreeItem(TreeView_InsertItem(GetDlgItem(hWnd, IDC_GROUP), &tvis)); + group->setListNext(groups); + groups = group; + if (par != NULL) { + TreeView_Expand(GetDlgItem(hWnd, IDC_GROUP), par->getTreeItem(), TVE_EXPAND); + } + Utils::mucc_mir_free(lps1); + } +} + +void ManagerWindow::queryResultRooms(MUCCQUERYRESULT *queryResult) +{ + ChatRoom *room; + while (rooms!=NULL) { + room = rooms; + rooms = rooms->getNext(); + delete room; + } + TCHAR str[100]; + if (getCurrentGroup()==NULL || strcmp(getCurrentGroup()->getId(), queryResult->pszParent) || queryResult->iPage!=getCurrentRoomsPage()) return; + setLastRoomsPage(queryResult->iLastPage); + if (queryResult->iLastPage) { + EnableWindow(GetDlgItem(getChatRoomsTabHWND(), IDC_NEXT), FALSE); + } else { + EnableWindow(GetDlgItem(getChatRoomsTabHWND(), IDC_NEXT), TRUE); + } + if (queryResult->iPage>0) { + EnableWindow(GetDlgItem(getChatRoomsTabHWND(), IDC_PREV), TRUE); + } else { + EnableWindow(GetDlgItem(getChatRoomsTabHWND(), IDC_PREV), FALSE); + } + for (int i=0; iiItemsNum; i++) { + LVITEM lvItem; + room = new ChatRoom(); + room->setId(queryResult->pItems[i].pszID); + room->setName(queryResult->pItems[i].pszName); + room->setFlags(queryResult->pItems[i].dwFlags); + room->setNext(rooms); + rooms=room; + lvItem.mask = LVIF_TEXT | LVIF_PARAM; + lvItem.iSubItem = 0; + lvItem.iItem = ListView_GetItemCount(GetDlgItem(getChatRoomsTabHWND(), IDC_ROOM)); + LPTSTR lps1 = Utils::mucc_mir_a2t(queryResult->pItems[i].pszName); + lvItem.pszText = lps1; + lvItem.lParam = (LPARAM) room; + ListView_InsertItem(GetDlgItem(getChatRoomsTabHWND(), IDC_ROOM), &lvItem); + lvItem.iSubItem = 1; + ListView_InsertItem(GetDlgItem(getChatRoomsTabHWND(), IDC_ROOM), &lvItem); + _stprintf(str, _TEXT("%d"), queryResult->pItems[i].iCount); + ListView_SetItemText(GetDlgItem(getChatRoomsTabHWND(), IDC_ROOM), lvItem.iItem, 1, str); + Utils::mucc_mir_free(lps1); + } +} + +void ManagerWindow::queryResultUserRooms(MUCCQUERYRESULT *queryResult) +{ + ChatRoom *room; + ListView_DeleteAllItems(GetDlgItem(getMyRoomsTabHWND(), IDC_LIST)); + while (myRooms!=NULL) { + room = myRooms; + myRooms = myRooms->getNext(); + delete room; + } + for (int i=0; iiItemsNum; i++) { + LVITEM lvItem; + room = new ChatRoom(); + room->setId(queryResult->pItems[i].pszID); + room->setName(queryResult->pItems[i].pszName); + room->setNext(myRooms); + myRooms=room; + lvItem.mask = LVIF_TEXT | LVIF_PARAM; + lvItem.iSubItem = 0; + lvItem.iItem = ListView_GetItemCount(GetDlgItem(getMyRoomsTabHWND(), IDC_LIST)); + LPTSTR lps1 = Utils::mucc_mir_a2t(queryResult->pItems[i].pszName); + lvItem.pszText = lps1; + lvItem.lParam = (LPARAM) room; + ListView_InsertItem(GetDlgItem(getMyRoomsTabHWND(), IDC_LIST), &lvItem); + Utils::mucc_mir_free(lps1); + } + userRoomList = 1; +} + +void ManagerWindow::queryResultUserNick(MUCCQUERYRESULT *queryResult) +{ + ListView_DeleteAllItems(GetDlgItem(getMyNicksTabHWND(), IDC_LIST)); + for (int i=0; iiItemsNum; i++) { + LVITEM lvItem; + lvItem.mask = LVIF_TEXT; + lvItem.iSubItem = 0; + lvItem.iItem = ListView_GetItemCount(GetDlgItem(getMyNicksTabHWND(), IDC_LIST)); + LPTSTR lps1 = Utils::mucc_mir_a2t(queryResult->pItems[i].pszName); + lvItem.pszText = lps1; + ListView_InsertItem(GetDlgItem(getMyNicksTabHWND(), IDC_LIST), &lvItem); + Utils::mucc_mir_free(lps1); + } + userNickList = 1; +} + +ChatGroup *ManagerWindow::findGroup(const char *id) +{ + ChatGroup *group; + for (group = groups;group!=NULL;group=group->getListNext()) { + if (!strcmp(group->getId(), id)) break; + } + return group; +} + + +static INT_PTR CALLBACK ChatRoomsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + HWND lv; + LVCOLUMN lvCol; + ManagerWindow *manager; + manager = (ManagerWindow *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + switch (msg) { + case WM_INITDIALOG: + manager = (ManagerWindow *)lParam; + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) manager); + TranslateDialogDefault(hwndDlg); + manager->setChatRoomsTabHWND(hwndDlg); + SendDlgItemMessage(hwndDlg, IDC_PREV, BUTTONSETASFLATBTN, 0, 0); + SendDlgItemMessage(hwndDlg, IDC_NEXT, BUTTONSETASFLATBTN, 0, 0); + SendDlgItemMessage(hwndDlg, IDC_SEARCH, BUTTONSETASFLATBTN, 0, 0); + SendDlgItemMessage(hwndDlg, IDC_PREV, BM_SETIMAGE, IMAGE_ICON, (LPARAM) muccIcon[MUCC_IDI_PREV]); + SendDlgItemMessage(hwndDlg, IDC_NEXT, BM_SETIMAGE, IMAGE_ICON, (LPARAM) muccIcon[MUCC_IDI_NEXT]); + SendDlgItemMessage(hwndDlg, IDC_SEARCH, BM_SETIMAGE, IMAGE_ICON, (LPARAM) muccIcon[MUCC_IDI_SEARCH]); + + lv = GetDlgItem(hwndDlg, IDC_ROOM); + ListView_SetExtendedListViewStyle(lv, LVS_EX_FULLROWSELECT); + lvCol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; + lvCol.pszText = TranslateT("Name"); + lvCol.cx = 270; + lvCol.iSubItem = 0; + ListView_InsertColumn(lv, 0, &lvCol); + lvCol.pszText = TranslateT("Persons"); + lvCol.cx = 50; + lvCol.iSubItem = 1; + ListView_InsertColumn(lv, 1, &lvCol); + lvCol.pszText = _TEXT("");//Translate(""); + lvCol.cx = 46; + lvCol.iSubItem = 2; + ListView_InsertColumn(lv, 2, &lvCol); + return TRUE; + case WM_NOTIFY: + switch (wParam) { + case IDC_ROOM: + switch (((LPNMHDR)lParam)->code) { + case LVN_COLUMNCLICK: + { + LPNMLISTVIEW pnmlv = (LPNMLISTVIEW) lParam; + if (pnmlv->iSubItem>=0 && pnmlv->iSubItem<=1) { + // if (pnmlv->iSubItem == sortColumn) + // sortAscending = !sortAscending; + // else { + // sortAscending = TRUE; + // sortColumn = pnmlv->iSubItem; + // } + // ListView_SortItems(GetDlgItem(hwndDlg, IDC_ROOM), GroupchatCompare, sortColumn); + } + } + break; + case NM_DBLCLK: + { + LPNMITEMACTIVATE lpnmitem = (LPNMITEMACTIVATE) lParam; + LVITEM item; + item.iItem = lpnmitem->iItem; + item.iSubItem = 0; + item.mask = LVIF_PARAM; + if (ListView_GetItem(GetDlgItem(hwndDlg, IDC_ROOM), &item)) { + MUCCEVENT event; + ChatRoom *room = (ChatRoom *)item.lParam; + Utils::log("entering room %s ", room->getId()); + event.cbSize = sizeof(MUCCEVENT); + event.iType = MUCC_EVENT_JOIN; + event.pszModule = manager->getModule(); + event.pszID = room->getId(); + event.pszName = room->getName(); + event.dwFlags = room->getFlags(); + event.pszNick = NULL; + HelperDialog::joinDlg(&event); + } + } + break; + } + break; + } + break; + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_NEXT: + if (!manager->isLastRoomsPage()) { + EnableWindow(GetDlgItem(hwndDlg, IDC_PREV), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_NEXT), FALSE); + manager->setCurrentRoomsPage(manager->getCurrentRoomsPage()+1); + SendMessage(GetParent(hwndDlg), WM_MUCC_REFRESH_ROOMS, 0, 0); + } + break; + case IDC_PREV: + if (manager->getCurrentRoomsPage()>0) { + EnableWindow(GetDlgItem(hwndDlg, IDC_PREV), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_NEXT), FALSE); + manager->setCurrentRoomsPage(manager->getCurrentRoomsPage()-1); + } + SendMessage(GetParent(hwndDlg), WM_MUCC_REFRESH_ROOMS, 0, 0); + break; + case IDC_SEARCH: + { + MUCCEVENT event; + event.cbSize = sizeof(MUCCEVENT); + event.iType = MUCC_EVENT_JOIN; + event.dwFlags = MUCC_EF_ROOM_NAME; + event.pszModule = manager->getModule(); + event.pszID = NULL; + event.pszName = NULL; + event.pszNick = NULL; + HelperDialog::joinDlg(&event); + break; + } + } + break; + case WM_MEASUREITEM: + if (wParam == IDC_ROOM) { + MEASUREITEMSTRUCT *lpMis = (MEASUREITEMSTRUCT *) lParam; + lpMis->itemHeight = GetSystemMetrics(SM_CYSMICON); + return TRUE; + } + break; + case WM_DRAWITEM: + if (wParam == IDC_ROOM) { + RECT rc; + int w, x, col; + DRAWITEMSTRUCT *lpDis = (DRAWITEMSTRUCT *) lParam; + ChatRoom *room = NULL; +// if (ListView_GetItem(GetDlgItem(hwndDlg, IDC_ROOM), &item)) { + room = (ChatRoom *)lpDis->itemData;// (ChatRoom *)item.lParam; +// } + TCHAR text[256]; + switch (lpDis->itemAction) { + default: + case ODA_SELECT: + case ODA_DRAWENTIRE: + if (lpDis->itemState & ODS_SELECTED) { + HBRUSH hBrush = CreateSolidBrush(RGB(0xC2, 0xC8, 0xDA));//0xDAC8C2); + FillRect(lpDis->hDC, &(lpDis->rcItem), hBrush);//(HBRUSH) (COLOR_HIGHLIGHT+1)); + DeleteObject(hBrush); + SetTextColor(lpDis->hDC, 0); + SetBkMode(lpDis->hDC, TRANSPARENT); + } + else { +// HBRUSH hBrush = CreateSolidBrush(RGB(0xC2, 0xC8, 0xDA));//0xDAC8C2); + FillRect(lpDis->hDC, &(lpDis->rcItem), (HBRUSH) (COLOR_WINDOW+1)); +// DeleteObject(hBrush); + SetTextColor(lpDis->hDC, RGB(0, 0, 0));//GetSysColor(COLOR_WINDOWTEXT)); +// SetBkColor(lpDis->hDC, GetSysColor(COLOR_WINDOW+1)); + SetBkMode(lpDis->hDC, TRANSPARENT); + } + x = lpDis->rcItem.left; + for (col=0;col<3;col++) { + ListView_GetItemText(GetDlgItem(hwndDlg, IDC_ROOM), lpDis->itemID, col, text, sizeof(text)/sizeof(TCHAR)); + w = ListView_GetColumnWidth(GetDlgItem(hwndDlg, IDC_ROOM), col); + rc.left = x; + rc.top = lpDis->rcItem.top; + rc.bottom = lpDis->rcItem.bottom; + rc.right = x+w; + if (col==0) { + rc.left+=2; + rc.right-=2; + DrawText(lpDis->hDC, text, (int)_tcslen(text), &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER); + } + else if (col<2) { + DrawText(lpDis->hDC, text, (int)_tcslen(text), &rc, DT_CENTER|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER); + } else { + if (room->getFlags()&MUCC_EF_ROOM_MODERATED) { + DrawIconEx(lpDis->hDC, x, rc.top, muccIcon[MUCC_IDI_R_MODERATED], GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL); + } + if (room->getFlags()&MUCC_EF_ROOM_MEMBERS_ONLY) { + DrawIconEx(lpDis->hDC, x+12+0*GetSystemMetrics(SM_CXSMICON), rc.top, muccIcon[MUCC_IDI_R_MEMBERS], GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL); + } + if (!(room->getFlags()&MUCC_EF_ROOM_NICKNAMES)) { + DrawIconEx(lpDis->hDC, x+24+0*GetSystemMetrics(SM_CXSMICON), rc.top, muccIcon[MUCC_IDI_R_ANONYMOUS], GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL); + } + } + x += w; + } + break; + } + } + break; + } + return FALSE; +} + +static INT_PTR CALLBACK MyRoomsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + RECT rc; + HWND lv; + LVCOLUMN lvCol; + ManagerWindow *manager; + manager = (ManagerWindow *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + switch (msg) { + case WM_INITDIALOG: + manager = (ManagerWindow *)lParam; + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) manager); + TranslateDialogDefault(hwndDlg); + manager->setMyRoomsTabHWND(hwndDlg); + lv = GetDlgItem(hwndDlg, IDC_LIST); + ListView_SetExtendedListViewStyle(lv, LVS_EX_FULLROWSELECT); + GetClientRect(lv, &rc); + lvCol.mask = LVCF_WIDTH; + lvCol.cx = rc.right - rc.left; + ListView_InsertColumn(lv, 0, &lvCol); + return TRUE; + case WM_NOTIFY: + switch (wParam) { + case IDC_LIST: + switch (((LPNMHDR)lParam)->code) { + case NM_DBLCLK: + { + LVITEM item; + item.iItem = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LIST)); + if (item.iItem >= 0) { + item.iSubItem = 0; + item.mask = LVIF_PARAM; + if (ListView_GetItem(GetDlgItem(hwndDlg, IDC_LIST), &item)) { + ChatRoom *room = (ChatRoom *)item.lParam; + Utils::log("entering room %s (%s)", room->getId(), room->getId()); + MUCCEVENT muce; + muce.cbSize = sizeof(MUCCEVENT); + muce.iType = MUCC_EVENT_JOIN; + muce.pszModule = manager->getModule(); + muce.pszID = room->getId(); + muce.pszName = room->getName(); + muce.dwFlags = MUCC_EF_ROOM_NICKNAMES; + muce.pszNick = NULL; + HelperDialog::joinDlg(&muce); + } + } + } + break; + } + break; + } + break; + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_REFRESH: + SendMessage(GetParent(hwndDlg), WM_MUCC_REFRESH_USER_ROOMS, 0, 0); + break; + case IDC_REGISTER: + { + MUCCEVENT muce; + if (manager->getCurrentGroup()!=NULL) { + TCHAR name[256]; + GetDlgItemText(hwndDlg, IDC_NAME, name, 255); + if (_tcslen(name)!=0) { + int flags = 0; + if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_PUBLIC)) { + flags |= MUCC_EF_ROOM_PUBLIC; + } + if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_PERMANENT)) { + flags |= MUCC_EF_ROOM_PERMANENT; + } + if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_MEMBERS)) { + flags |= MUCC_EF_ROOM_MEMBERS_ONLY; + } + if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_NICKNAMES)) { + flags |= MUCC_EF_ROOM_NICKNAMES; + } + muce.cbSize = sizeof(MUCCEVENT); + muce.iType = MUCC_EVENT_REGISTER_ROOM; + muce.pszModule = manager->getModule(); + muce.pszID = manager->getCurrentGroup()->getId(); + char* lps1 = Utils::mucc_mir_t2a(name); + muce.pszName = lps1; + muce.pszNick = NULL; + muce.dwFlags = flags; + NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce); + Utils::mucc_mir_free(lps1); + } + } else { + muce.pszText = "Please select a group first."; + HelperDialog::errorDlg(&muce); + } + } + break; + } + break; + case WM_MEASUREITEM: + if (wParam == IDC_LIST) { + MEASUREITEMSTRUCT *lpMis = (MEASUREITEMSTRUCT *) lParam; + lpMis->itemHeight = 16;//GetSystemMetrics(SM_CYSMICON); + return TRUE; + } + break; + case WM_DRAWITEM: + if (wParam == IDC_LIST) { + TCHAR text[256]; + DRAWITEMSTRUCT *lpDis = (DRAWITEMSTRUCT *) lParam; + switch (lpDis->itemAction) { + default: + case ODA_SELECT: + case ODA_DRAWENTIRE: + if (lpDis->itemState & ODS_SELECTED) { + HBRUSH hBrush = CreateSolidBrush(RGB(0xC2, 0xC8, 0xDA));//0xDAC8C2); + FillRect(lpDis->hDC, &(lpDis->rcItem), hBrush);//(HBRUSH) (COLOR_HIGHLIGHT+1)); + DeleteObject(hBrush); + SetTextColor(lpDis->hDC, 0); + SetBkMode(lpDis->hDC, TRANSPARENT); + } + else { + FillRect(lpDis->hDC, &(lpDis->rcItem), (HBRUSH) (COLOR_WINDOW+1)); + SetTextColor(lpDis->hDC, RGB(0, 0, 0));//GetSysColor(COLOR_WINDOWTEXT)); + SetBkMode(lpDis->hDC, TRANSPARENT); + } + ListView_GetItemText(GetDlgItem(hwndDlg, IDC_LIST), lpDis->itemID, 0, text, sizeof(text)/sizeof(TCHAR)); + DrawText(lpDis->hDC, text, (int)_tcslen(text), &(lpDis->rcItem), DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER); + break; + } + } + break; + + } + return FALSE; +} + +static INT_PTR CALLBACK MyNicksDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + RECT rc; + HWND lv; + LVCOLUMN lvCol; + ManagerWindow *manager; + manager = (ManagerWindow *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + switch (msg) { + case WM_INITDIALOG: + manager = (ManagerWindow *)lParam; + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) manager); + TranslateDialogDefault(hwndDlg); + manager->setMyNicksTabHWND(hwndDlg); + lv = GetDlgItem(hwndDlg, IDC_LIST); + ListView_SetExtendedListViewStyle(lv, LVS_EX_FULLROWSELECT); + GetClientRect(lv, &rc); + lvCol.mask = LVCF_WIDTH; + lvCol.cx = rc.right - rc.left; + ListView_InsertColumn(lv, 0, &lvCol); + return TRUE; + case WM_NOTIFY: + switch (wParam) { + case IDC_LIST: + break; + + } + break; + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_REFRESH: + SendMessage(GetParent(hwndDlg), WM_MUCC_REFRESH_USER_NICKS, 0, 0); + break; + case IDC_REGISTER: + { + char nick[256]; + GetDlgItemTextA(hwndDlg, IDC_NICK, nick, 255); + if (strlen(nick)!=0) { + MUCCEVENT muce; + muce.cbSize = sizeof(MUCCEVENT); + muce.iType = MUCC_EVENT_REGISTER_NICK; + muce.pszModule = manager->getModule(); + muce.pszNick = nick; + NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce); + } + } + break; + case IDC_REMOVE: + { + LVITEM item; + item.iItem = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LIST)); + if (item.iItem >= 0) { + TCHAR text[256]; + item.iSubItem = 0; + item.mask = LVIF_TEXT; + item.pszText = text; + item.cchTextMax = sizeof(text); + if (ListView_GetItem(GetDlgItem(hwndDlg, IDC_LIST), &item)) { + MUCCEVENT muce; + muce.cbSize = sizeof(MUCCEVENT); + muce.iType = MUCC_EVENT_REMOVE_NICK; + muce.pszModule = manager->getModule(); + char* lps2 = Utils::mucc_mir_t2a(text); + muce.pszNick = lps2; + NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce); + Utils::mucc_mir_free(lps2); + } + } + } + } + break; + case WM_MEASUREITEM: + if (wParam == IDC_LIST) { + MEASUREITEMSTRUCT *lpMis = (MEASUREITEMSTRUCT *) lParam; + lpMis->itemHeight = 16;//GetSystemMetrics(SM_CYSMICON); + return TRUE; + } + break; + case WM_DRAWITEM: + if (wParam == IDC_LIST) { + TCHAR text[256]; + DRAWITEMSTRUCT *lpDis = (DRAWITEMSTRUCT *) lParam; + switch (lpDis->itemAction) { + default: + case ODA_SELECT: + case ODA_DRAWENTIRE: + if (lpDis->itemState & ODS_SELECTED) { + HBRUSH hBrush = CreateSolidBrush(RGB(0xC2, 0xC8, 0xDA));//0xDAC8C2); + FillRect(lpDis->hDC, &(lpDis->rcItem), hBrush);//(HBRUSH) (COLOR_HIGHLIGHT+1)); + DeleteObject(hBrush); + SetTextColor(lpDis->hDC, 0); + SetBkMode(lpDis->hDC, TRANSPARENT); + } + else { + FillRect(lpDis->hDC, &(lpDis->rcItem), (HBRUSH) (COLOR_WINDOW+1)); + SetTextColor(lpDis->hDC, RGB(0, 0, 0));//GetSysColor(COLOR_WINDOWTEXT)); + SetBkMode(lpDis->hDC, TRANSPARENT); + } + ListView_GetItemText(GetDlgItem(hwndDlg, IDC_LIST), lpDis->itemID, 0, text, sizeof(text)/sizeof(TCHAR)); + DrawText(lpDis->hDC, text, (int)_tcslen(text), &(lpDis->rcItem), DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER); + break; + } + } + break; + } + return FALSE; +} + +static INT_PTR CALLBACK ManagerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + HWND hwnd, tc; + TCITEM tci; + char text[128]; +// HIMAGELIST hImageList; + ManagerWindow *manager; + MUCCEVENT muce; + int dlgWidth, dlgHeight, tabPos; + RECT rc2; + + manager = (ManagerWindow *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + if (manager==NULL && msg!=WM_INITDIALOG) return FALSE; + switch (msg) { + case WM_INITDIALOG: + // lParam is the initial conference server (if any) + manager = (ManagerWindow *)lParam; + manager->setHWND(hwndDlg); + sprintf(text, "%s Chats", manager->getModuleName()); + SetWindowTextA(hwndDlg, text); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) manager); + SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) muccIcon[MUCC_IDI_CHAT]); + + TranslateDialogDefault(hwndDlg); +// sortColumn = -1; + manager->setCurrentTab(0); + tc = GetDlgItem(hwndDlg, IDC_TABS); + tci.mask = TCIF_TEXT; + // Public rooms tab + tci.pszText = TranslateT("Chat rooms"); + TabCtrl_InsertItem(tc, 0, &tci); + // Create room tab + tci.pszText = TranslateT("My rooms"); + TabCtrl_InsertItem(tc, 1, &tci); + tci.pszText = TranslateT("My nicknames"); + TabCtrl_InsertItem(tc, 2, &tci); + hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_TAB_CHATROOMS), hwndDlg, ChatRoomsDlgProc, (LPARAM) manager); + SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + ShowWindow(hwnd, SW_SHOW); + hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_TAB_MYROOMS), hwndDlg, MyRoomsDlgProc, (LPARAM) manager); + SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_TAB_MYNICKNAMES), hwndDlg, MyNicksDlgProc, (LPARAM) manager); + SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + EnableWindow(GetDlgItem(manager->getChatRoomsTabHWND(), IDC_PREV), FALSE); + EnableWindow(GetDlgItem(manager->getChatRoomsTabHWND(), IDC_NEXT), FALSE); + + GetWindowRect(manager->getMyRoomsTabHWND(), &rc2); + rc2.right-=rc2.left; + rc2.bottom-=rc2.top; + SetWindowPos(hwndDlg, NULL, 0, 0, rc2.right+300, 118+rc2.bottom, SWP_NOMOVE | SWP_NOZORDER); + TreeView_SetItemHeight(GetDlgItem(hwndDlg, IDC_GROUP), 16); +// hImageList=ImageList_Create(100, 100, ILC_COLOR32, 0, 10); +// ListView_SetImageList(GetDlgItem(hwndDlg, IDC_ROOM), hImageList, LVSIL_SMALL); + SetEvent(manager->getEvent()); + muce.cbSize = sizeof(MUCCEVENT); + muce.iType = MUCC_EVENT_QUERY_GROUPS; + muce.pszModule = manager->getModule(); + muce.pszID = NULL; + NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce); + return TRUE; + case WM_SIZING: + RECT *rc, rc2; + rc = (RECT *)lParam; + GetWindowRect(manager->getMyRoomsTabHWND(), &rc2); + rc2.right-=rc2.left; + rc2.bottom-=rc2.top; + if (rc->right-rc->left<(rc2.right+80)) { + if (wParam == WMSZ_RIGHT || wParam == WMSZ_BOTTOMRIGHT || wParam == WMSZ_TOPRIGHT) { + rc->right=rc->left+rc2.right+80; + } else { + rc->left=rc->right-rc2.right-80; + } + } + if (rc->bottom-rc->top<118+rc2.bottom || rc->bottom-rc->top>118+rc2.bottom) { + if (wParam == WMSZ_BOTTOM || wParam == WMSZ_BOTTOMLEFT || wParam == WMSZ_BOTTOMRIGHT) { + rc->bottom=rc->top+118+rc2.bottom; + } else { + rc->top=rc->bottom-118-rc2.bottom; + } + } + return TRUE; + case WM_SIZE: + if (wParam==SIZE_RESTORED || wParam==SIZE_MAXIMIZED) { + HDWP hdwp; + dlgWidth = LOWORD(lParam); + dlgHeight = HIWORD(lParam); + GetWindowRect(manager->getMyRoomsTabHWND(), &rc2); + rc2.right-=rc2.left; + rc2.bottom-=rc2.top; + tabPos = dlgWidth - rc2.right - 15; + hdwp = BeginDeferWindowPos(6); + hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_TABS), 0, tabPos, 10, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + hdwp = DeferWindowPos(hdwp, manager->getChatRoomsTabHWND(), 0, tabPos+3, 45, 371, 292, SWP_NOZORDER | SWP_NOSIZE); + hdwp = DeferWindowPos(hdwp, manager->getMyRoomsTabHWND() , 0, tabPos+3, 45, 371, 292, SWP_NOZORDER | SWP_NOSIZE); + hdwp = DeferWindowPos(hdwp, manager->getMyNicksTabHWND() , 0, tabPos+3, 45, 371, 292, SWP_NOZORDER | SWP_NOSIZE); + hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_GROUP), 0, 0, 0, tabPos-16, dlgHeight-40, SWP_NOZORDER | SWP_NOMOVE); + hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDCLOSE), 0, dlgWidth-88, dlgHeight-34, 0, 0 , SWP_NOZORDER | SWP_NOSIZE); + EndDeferWindowPos(hdwp); + } + break; + case WM_NOTIFY: + switch (wParam) { + case IDC_GROUP: + switch (((LPNMHDR)lParam)->code) { + case TVN_ITEMEXPANDING: + { + LPNMTREEVIEW pnmtv = (LPNMTREEVIEW) lParam; + if (pnmtv->action==TVE_EXPAND) { + TVITEM item = (TVITEM) pnmtv->itemNew; + ChatGroup *group = (ChatGroup *) item.lParam;// manager->findGroup(item.hItem); + if (group!=NULL) { + if (group->getChild()==NULL) { + muce.cbSize = sizeof(MUCCEVENT); + muce.iType = MUCC_EVENT_QUERY_GROUPS; + muce.pszModule = manager->getModule(); + muce.pszID = group->getId(); + NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce); + } + } + } + } + break; + case TVN_SELCHANGED: + { + LPNMTREEVIEW pnmtv = (LPNMTREEVIEW) lParam; + TVITEM item = (TVITEM) pnmtv->itemNew; + ChatGroup *group = (ChatGroup *) item.lParam;// manager->findGroup(item.hItem); + if (group!=NULL) { + EnableWindow(GetDlgItem(manager->getChatRoomsTabHWND(), IDC_PREV), FALSE); + EnableWindow(GetDlgItem(manager->getChatRoomsTabHWND(), IDC_NEXT), FALSE); + ListView_DeleteAllItems(GetDlgItem(manager->getChatRoomsTabHWND(), IDC_ROOM)); + manager->setCurrentGroup(group); + manager->setCurrentRoomsPage(0); + muce.cbSize = sizeof(MUCCEVENT); + muce.iType = MUCC_EVENT_QUERY_ROOMS; + muce.pszModule = manager->getModule(); + muce.pszID = (char *)group->getId(); + muce.dwData = 0; + NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce); + } + } + break; + case NM_CUSTOMDRAW: + { + if (((LPNMHDR)lParam)->idFrom == IDC_GROUP) { + LPNMTVCUSTOMDRAW pCustomDraw = (LPNMTVCUSTOMDRAW)lParam; + switch (pCustomDraw->nmcd.dwDrawStage) { + case CDDS_PREPAINT: + SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,CDRF_NOTIFYITEMDRAW); + return TRUE; + case CDDS_ITEMPREPAINT: + { + if (pCustomDraw->nmcd.uItemState & CDIS_FOCUS) { // selected (CDIS_FOCUS | CDIS_SELECTED + pCustomDraw->clrText = 0; + pCustomDraw->clrTextBk = 0xDAC8C2; + } + else { + pCustomDraw->clrText = 0; + } + // HBRUSH hBr; + // hBr = CreateSolidBrush(pCustomDraw->clrTextBk);//g_LogOptions.crUserListBGColor ) ; + // FillRect(pCustomDraw->nmcd.hdc, &rc, hBr); + // DeleteObject(hBr); + SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT, CDRF_NEWFONT); + return TRUE; + } + } + } + } + break; + } + break; + case IDC_TABS: + switch (((LPNMHDR) lParam)->code) { + case TCN_SELCHANGE: + switch (manager->getCurrentTab()) { + case 0: + ShowWindow(manager->getChatRoomsTabHWND(), SW_HIDE); + break; + case 1: + ShowWindow(manager->getMyRoomsTabHWND(), SW_HIDE); + break; + case 2: + ShowWindow(manager->getMyNicksTabHWND(), SW_HIDE); + break; + } + manager->setCurrentTab(TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TABS))); + switch (manager->getCurrentTab()) { + case 0: + ShowWindow(manager->getChatRoomsTabHWND(), SW_SHOW); + break; + case 1: + ShowWindow(manager->getMyRoomsTabHWND(), SW_SHOW); + if (!manager->isUserRoomListReceived()) { + SendMessage(hwndDlg, WM_MUCC_REFRESH_USER_ROOMS, 0, 0); + } + break; + case 2: + ShowWindow(manager->getMyNicksTabHWND(), SW_SHOW); + if (!manager->isUserNickListReceived()) { + SendMessage(hwndDlg, WM_MUCC_REFRESH_USER_NICKS, 0, 0); + } + break; + } + break; + } + break; + } + break; + case WM_MUCC_REFRESH_USER_ROOMS: + muce.cbSize = sizeof(MUCCEVENT); + muce.iType = MUCC_EVENT_QUERY_USER_ROOMS; + muce.pszModule = manager->getModule(); + muce.pszID = NULL; + NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce); + break; + case WM_MUCC_REFRESH_USER_NICKS: + muce.cbSize = sizeof(MUCCEVENT); + muce.iType = MUCC_EVENT_QUERY_USER_NICKS; + muce.pszModule = manager->getModule(); + muce.pszID = NULL; + NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce); + break; + case WM_MUCC_REFRESH_ROOMS: + { + ChatGroup *group = manager->getCurrentGroup(); + if (manager->getCurrentGroup()!=NULL) { + EnableWindow(GetDlgItem(manager->getChatRoomsTabHWND(), IDC_PREV), FALSE); + EnableWindow(GetDlgItem(manager->getChatRoomsTabHWND(), IDC_NEXT), FALSE); + ListView_DeleteAllItems(GetDlgItem(manager->getChatRoomsTabHWND(), IDC_ROOM)); + /* + * TODO: delete rooms here !!! + */ + muce.cbSize = sizeof(MUCCEVENT); + muce.iType = MUCC_EVENT_QUERY_ROOMS; + muce.pszModule = manager->getModule(); + muce.pszID = (char *)group->getId(); + muce.dwData = manager->getCurrentRoomsPage(); + NotifyEventHooks(hHookEvent, 0,(WPARAM)&muce); + } + } + break; + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDCLOSE: + ShowWindow(hwndDlg, SW_HIDE); + break; + } + break; + case WM_CLOSE: + ShowWindow(hwndDlg, SW_HIDE); + break; + + } + return FALSE; +} + +ManagerWindow* ManagerWindow::getWindow(const char *module) { + ManagerWindow *ptr; + EnterCriticalSection(&mutex); + for (ptr=list;ptr!=NULL;ptr=ptr->getNext()) { + if (strcmp(ptr->getModule(), module)==0) { + break; + } + } + LeaveCriticalSection(&mutex); + if (ptr==NULL) { + ptr = new ManagerWindow(module); + } + return ptr; +} + diff --git a/!NotAdopted/Tlen/tlen_czaty/ManagerWindow.h b/!NotAdopted/Tlen/tlen_czaty/ManagerWindow.h new file mode 100644 index 0000000000..f57d1c1057 --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/ManagerWindow.h @@ -0,0 +1,93 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +#ifndef MANAGERWINDOW_INCLUDED +#define MANAGERWINDOW_INCLUDED +#include "mucc.h" +#include "ChatGroup.h" +#include "ChatRoom.h" + +class ManagerWindow{ + +private: + static CRITICAL_SECTION mutex; + static bool released; + static ManagerWindow * list; + HWND hWnd; + HWND hChatRoomsTabWnd; + HWND hMyRoomsTabWnd; + HWND hMyNicksTabWnd; + HANDLE hEvent; + ManagerWindow * prev; + ManagerWindow * next; + ChatGroup * groups; + ChatRoom * rooms; + ChatRoom * myRooms; + char * module; + char * moduleName; + ChatGroup * currentGroup; + int isStarted; + int userNickList, userRoomList; + int currentTab; + int currentRoomsPage; + int lastRoomsPage; +public: + ManagerWindow (const char *module); + ~ManagerWindow (); + int start(); + ChatGroup * findGroup(const char *id); + void queryResultGroups(MUCCQUERYRESULT *queryResult); + void queryResultRooms(MUCCQUERYRESULT *queryResult); + void queryResultUserRooms(MUCCQUERYRESULT *queryResult); + void queryResultUserNick(MUCCQUERYRESULT *queryResult); + ManagerWindow * getNext(); + void setNext(ManagerWindow *); + ManagerWindow * getPrev(); + void setPrev(ManagerWindow *); + void setHWND(HWND); + HWND getHWND(); + HANDLE getEvent(); + void setChatRoomsTabHWND(HWND); + HWND getChatRoomsTabHWND(); + void setMyNicksTabHWND(HWND); + HWND getMyNicksTabHWND(); + void setMyRoomsTabHWND(HWND); + HWND getMyRoomsTabHWND(); + void setModuleName(const char *moduleName); + void setCurrentTab(int); + int getCurrentTab(); + const char * getModule(); + const char * getModuleName(); + void setCurrentGroup(ChatGroup *); + ChatGroup * getCurrentGroup(); + void setCurrentRoomsPage(int); + int getCurrentRoomsPage(); + void setLastRoomsPage(int); + int isLastRoomsPage(); + int isUserRoomListReceived(); + int isUserNickListReceived(); + + static ManagerWindow* getWindow(const char *module); + static void release(); + static void init(); + +}; +#endif + diff --git a/!NotAdopted/Tlen/tlen_czaty/Options.cpp b/!NotAdopted/Tlen/tlen_czaty/Options.cpp new file mode 100644 index 0000000000..8e0f093ddd --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/Options.cpp @@ -0,0 +1,789 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#include "mucc.h" +#include "Options.h" +#include "ChatWindow.h" +#include "Utils.h" +#include "resource.h" +#include +#include "m_ieview.h" + +static INT_PTR CALLBACK MUCCOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); +//static INT_PTR CALLBACK MUCCLogOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); +//static INT_PTR CALLBACK MUCCPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); + + +COLORREF Options::colorListBg, Options::colorInputBg, Options::colorLogBg, Options::chatWindowFontColor; +HBRUSH Options::brushListBg=NULL, Options::brushInputBg=NULL, Options::brushLogBg=NULL; +int Options::logLimit, Options::chatWindowOptions, Options::chatContainerOptions; +int Options::chatWindowFont, Options::chatWindowFontSize, Options::chatWindowFontStyle; + +void Options::setListBgColor(COLORREF c) { + colorListBg = c; + if (brushListBg != NULL) { + DeleteObject(brushListBg); + } + brushListBg = CreateSolidBrush(colorListBg); +} + +void Options::setInputBgColor(COLORREF c) { + colorInputBg = c; + if (brushInputBg!= NULL) { + DeleteObject(brushInputBg); + } + brushInputBg = CreateSolidBrush(colorInputBg); +} + +void Options::setLogBgColor(COLORREF c) { + colorLogBg = c; + if (brushLogBg!= NULL) { + DeleteObject(brushLogBg); + } + brushLogBg = CreateSolidBrush(colorLogBg); +} + +COLORREF Options::getListBgColor() { + return colorListBg; +} + +COLORREF Options::getInputBgColor() { + return colorInputBg; +} + +COLORREF Options::getLogBgColor() { + return colorLogBg; +} + +HBRUSH Options::getListBgBrush() { + return brushListBg; +} + +HBRUSH Options::getInputBgBrush() { + return brushInputBg; +} + +HBRUSH Options::getLogBgBrush() { + return brushLogBg; +} + +void Options::setLogLimit(int l) { + logLimit = l; +} + +int Options::getLogLimit() { + return logLimit; +} + +void Options::setChatWindowFont(int o) { + chatWindowFont = o; +} + +int Options::getChatWindowFont() { + return chatWindowFont; +} + +void Options::setChatWindowFontSize(int o) { + chatWindowFontSize = o; +} + +int Options::getChatWindowFontSize() { + return chatWindowFontSize; +} + +void Options::setChatWindowFontStyle(int o) { + chatWindowFontStyle = o; +} + +int Options::getChatWindowFontStyle() { + return chatWindowFontStyle; +} + +void Options::setChatWindowFontColor(COLORREF o) { + chatWindowFontColor = o; +} + +COLORREF Options::getChatWindowFontColor() { + return chatWindowFontColor; +} + +void Options::setChatWindowOptions(int o) { + chatWindowOptions = o; +} + +int Options::getChatWindowOptions() { + return chatWindowOptions; +} + +void Options::setChatContainerOptions(int o) { + chatContainerOptions = o; +} + +int Options::getChatContainerOptions() { + return chatContainerOptions; +} + +void Options::setExpandFlags(int o) { + DBWriteContactSettingDword(NULL, muccModuleName, "ExpandFlags", o); +} + +int Options::getExpandFlags() { + return DBGetContactSettingDword(NULL, muccModuleName, "ExpandFlags", 0xFFFFFFFF); +} + +void Options::loadSettings() { + FontList::loadSettings(); + setLogBgColor((COLORREF)DBGetContactSettingDword(NULL, muccModuleName, "BackgroundLog", 0xFFFFFF)); + setListBgColor((COLORREF)DBGetContactSettingDword(NULL, muccModuleName, "BackgroundList", 0xFFFFFF)); + setInputBgColor((COLORREF)DBGetContactSettingDword(NULL, muccModuleName, "BackgroundTyping", 0xFFFFFF)); + setLogLimit(DBGetContactSettingDword(NULL, muccModuleName, "LogSizeLimit", 100)); + setChatContainerOptions(DBGetContactSettingDword(NULL, muccModuleName, "ChatContainerOptions", ChatContainer::getDefaultOptions())); + setChatWindowOptions(DBGetContactSettingDword(NULL, muccModuleName, "ChatWindowOptions", ChatWindow::getDefaultOptions())); + setChatWindowFont(DBGetContactSettingDword(NULL, muccModuleName, "ChatWindowFont", 0)); + setChatWindowFontSize(DBGetContactSettingDword(NULL, muccModuleName, "ChatWindowFontSize", 5)); + setChatWindowFontStyle(DBGetContactSettingDword(NULL, muccModuleName, "ChatWindowFontStyle", 0)); + setChatWindowFontColor(DBGetContactSettingDword(NULL, muccModuleName, "ChatWindowFontColor", 0)); +} + +void Options::saveSettings() { + FontList::saveSettings(); + DBWriteContactSettingDword(NULL, muccModuleName, "BackgroundLog", colorLogBg); + DBWriteContactSettingDword(NULL, muccModuleName, "BackgroundList", colorListBg); + DBWriteContactSettingDword(NULL, muccModuleName, "BackgroundTyping", colorInputBg); + DBWriteContactSettingDword(NULL, muccModuleName, "LogSizeLimit", logLimit); + DBWriteContactSettingDword(NULL, muccModuleName, "ChatContainerOptions", chatContainerOptions); + DBWriteContactSettingDword(NULL, muccModuleName, "ChatWindowOptions", chatWindowOptions); + DBWriteContactSettingDword(NULL, muccModuleName, "ChatWindowFont", chatWindowFont); + DBWriteContactSettingDword(NULL, muccModuleName, "ChatWindowFontSize", chatWindowFontSize); + DBWriteContactSettingDword(NULL, muccModuleName, "ChatWindowFontStyle", chatWindowFontStyle); + DBWriteContactSettingDword(NULL, muccModuleName, "ChatWindowFontColor", chatWindowFontColor); +} + +void Options::init() +{ + FontList::init(); + loadSettings(); +} + +int MUCCOptInit(WPARAM wParam, LPARAM lParam) +{ + OPTIONSDIALOGPAGE odp; + + ZeroMemory(&odp, sizeof(odp)); + odp.cbSize = sizeof(odp); + odp.position = 0; + odp.hInstance = hInst; + odp.pszGroup = Translate("Network"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); +// odp.pszTitle = muccModuleName; + odp.pszTitle = "Tlen czaty"; + odp.flags = ODPF_BOLDGROUPS; + odp.pfnDlgProc = MUCCOptDlgProc; + odp.nIDBottomSimpleControl = 0; + CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp); + + /* + odp.pszTemplate = MAKEINTRESOURCE(IDD_OPTIONS_LOG); + _snprintf(str, sizeof(str), "%s %s", muccModuleName, Translate("Log")); + str[sizeof(str)-1] = '\0'; + odp.pszTitle = str; + odp.pfnDlgProc = MUCCLLogOptDlgProc; + odp.flags = ODPF_BOLDGROUPS|ODPF_EXPERTONLY; + odp.nIDBottomSimpleControl = 0; + CallService(MS_OPT_ADDPAGE, wParam, (LPARAM) &odp); + if (ServiceExists(MS_POPUP_ADDPOPUP)) { + ZeroMemory(&odp,sizeof(odp)); + odp.cbSize = sizeof(odp); + odp.position = 100000000; + odp.hInstance = hInst; + odp.pszGroup = Translate("PopUps"); + odp.pszTemplate = MAKEINTRESOURCE(IDD_OPTIONS_POPUPS); + odp.pszTitle = jabberModuleName; + odp.flags=ODPF_BOLDGROUPS; + odp.pfnDlgProc = TlenPopupsDlgProc; + odp.nIDBottomSimpleControl = 0; + CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp); + } + +*/ + return 0; +} + + +static int getOptions(HWND hTreeControl, HTREEITEM hItem, int flags) { + TVITEM tvi = {0}; + tvi.mask = TVIF_HANDLE | TVIF_STATE | TVIF_PARAM; + tvi.stateMask = TVIS_STATEIMAGEMASK; + tvi.hItem = hItem; + TreeView_GetItem(hTreeControl, &tvi); + if ((tvi.state>>12) == 2) { + flags |= tvi.lParam; + } else { + flags &= ~tvi.lParam; + } + tvi.hItem = TreeView_GetChild(hTreeControl, hItem); + if (tvi.hItem != NULL) { + flags = getOptions(hTreeControl, tvi.hItem, flags); + } + tvi.hItem=TreeView_GetNextSibling(hTreeControl, hItem); + if (tvi.hItem != NULL) { + flags = getOptions(hTreeControl, tvi.hItem, flags); + } + return flags; + +} + +static int getExpandFlags(HWND hTreeControl) { + TVITEM tvi = {0}; + int flags =0, mask = 1; + tvi.mask = TVIF_HANDLE | TVIF_STATE; + tvi.stateMask = TVIS_EXPANDED; + tvi.hItem = TreeView_GetRoot(hTreeControl); + while (tvi.hItem != NULL) { + TreeView_GetItem(hTreeControl, &tvi); + if (tvi.state & TVIS_EXPANDED) { + flags |= mask; + } + mask <<= 1; + tvi.hItem=TreeView_GetNextSibling(hTreeControl, tvi.hItem); + } + return flags; +} + + +static int addOption(HWND hTreeControl, HTREEITEM hParent, const char *text, int flag) { + TVINSERTSTRUCT tvis; + tvis.hInsertAfter = TVI_LAST; + tvis.hParent = hParent; + tvis.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_PARAM; + char* textA = Translate(text); + LPTSTR textT = Utils::mucc_mir_a2t(textA); + tvis.item.pszText = textT; + tvis.item.lParam = flag; + tvis.item.stateMask = TVIS_STATEIMAGEMASK; + tvis.item.state = Options::getChatWindowOptions() & flag ? INDEXTOSTATEIMAGEMASK(2) : INDEXTOSTATEIMAGEMASK(1); + TreeView_InsertItem(hTreeControl, &tvis); + Utils::mucc_mir_free(textT); + return (Options::getChatWindowOptions() & flag) != 0; + +} + +static INT_PTR CALLBACK MUCCOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + int i; + char *pszText; + switch (msg) { + case WM_INITDIALOG: + { + TVINSERTSTRUCT tvis; + TVITEM tvi; + HWND hTreeControl; + HTREEITEM hItem; + int bCheckParent, expandFlags; + + TranslateDialogDefault(hwndDlg); + Options::loadSettings(); + for (i=0;igetColor()); + SendDlgItemMessage(hwndDlg, IDC_COLORBKG, CPM_SETCOLOUR, 0, Options::getLogBgColor()); + SendDlgItemMessage(hwndDlg, IDC_COLORLIST, CPM_SETCOLOUR, 0, Options::getListBgColor()); + SendDlgItemMessage(hwndDlg, IDC_COLORINPUT, CPM_SETCOLOUR, 0, Options::getInputBgColor()); + SendDlgItemMessage(hwndDlg, IDC_LOGLIMITSPIN, UDM_SETRANGE, 0, MAKELONG(1000,20)); + SendDlgItemMessage(hwndDlg, IDC_LOGLIMITSPIN, UDM_SETPOS, 0, MAKELONG(Options::getLogLimit(), 0)); + + SetWindowLong(GetDlgItem(hwndDlg,IDC_TREELIST),GWL_STYLE,GetWindowLong(GetDlgItem(hwndDlg,IDC_TREELIST),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES); + + + hTreeControl = GetDlgItem(hwndDlg, IDC_TREELIST); + expandFlags = Options::getExpandFlags(); + tvis.hInsertAfter = TVI_LAST; + tvis.item.mask = TVIF_TEXT | TVIF_PARAM; + tvis.hParent = NULL; + tvis.item.lParam = 0; + + tvi.mask = TVIF_HANDLE | TVIF_STATE; + tvi.stateMask = TVIS_STATEIMAGEMASK; + + tvis.item.pszText = TranslateT("Default Log Appearence"); + hItem = TreeView_InsertItem(hTreeControl, &tvis); + bCheckParent = 1; + bCheckParent &= addOption(hTreeControl, hItem, "Show nicknames", ChatWindow::FLAG_SHOW_NICKNAMES); + bCheckParent &= addOption(hTreeControl, hItem, "Show message on a new line", ChatWindow::FLAG_MSGINNEWLINE); + tvi.state = (bCheckParent ? INDEXTOSTATEIMAGEMASK(2) : INDEXTOSTATEIMAGEMASK(1)); + tvi.hItem = hItem; + TreeView_SetItem(hTreeControl, &tvi); + if (expandFlags & 1) { + TreeView_Expand(hTreeControl, hItem, TVE_EXPAND); + } + + tvis.item.pszText = TranslateT("Default Timestamp Settings"); + hItem = TreeView_InsertItem(hTreeControl, &tvis); + bCheckParent = 1; + bCheckParent &= addOption(hTreeControl, hItem, "Show date", ChatWindow::FLAG_SHOW_DATE); + bCheckParent &= addOption(hTreeControl, hItem, "Show timestamp", ChatWindow::FLAG_SHOW_TIMESTAMP); + bCheckParent &= addOption(hTreeControl, hItem, "Show seconds", ChatWindow::FLAG_SHOW_SECONDS); + bCheckParent &= addOption(hTreeControl, hItem, "Use long date format", ChatWindow::FLAG_LONG_DATE); + tvi.state = (bCheckParent ? INDEXTOSTATEIMAGEMASK(2) : INDEXTOSTATEIMAGEMASK(1)); + tvi.hItem = hItem; + TreeView_SetItem(hTreeControl, &tvi); + if (expandFlags & 2) { + TreeView_Expand(hTreeControl, hItem, TVE_EXPAND); + } + + tvis.item.pszText = TranslateT("Default Text Formatting Filter"); + hItem = TreeView_InsertItem(hTreeControl, &tvis); + bCheckParent = 1; + bCheckParent &= addOption(hTreeControl, hItem, "Font name", ChatWindow::FLAG_FORMAT_FONT); + bCheckParent &= addOption(hTreeControl, hItem, "Font size", ChatWindow::FLAG_FORMAT_SIZE); + bCheckParent &= addOption(hTreeControl, hItem, "Font style", ChatWindow::FLAG_FORMAT_STYLE); + bCheckParent &= addOption(hTreeControl, hItem, "Font color", ChatWindow::FLAG_FORMAT_COLOR); + tvi.state = (bCheckParent ? INDEXTOSTATEIMAGEMASK(2) : INDEXTOSTATEIMAGEMASK(1)); + tvi.hItem = hItem; + TreeView_SetItem(hTreeControl, &tvi); + if (expandFlags & 4) { + TreeView_Expand(hTreeControl, hItem, TVE_EXPAND); + } + + tvis.item.pszText = TranslateT("Default Event Filter"); + hItem = TreeView_InsertItem(hTreeControl, &tvis); + bCheckParent = 1; + bCheckParent &= addOption(hTreeControl, hItem, "Messages", ChatWindow::FLAG_LOG_MESSAGES); + bCheckParent &= addOption(hTreeControl, hItem, "User has joined", ChatWindow::FLAG_LOG_JOINED); + bCheckParent &= addOption(hTreeControl, hItem, "User has left", ChatWindow::FLAG_LOG_LEFT); + bCheckParent &= addOption(hTreeControl, hItem, "Topic changes", ChatWindow::FLAG_LOG_TOPIC); + tvi.state = (bCheckParent ? INDEXTOSTATEIMAGEMASK(2) : INDEXTOSTATEIMAGEMASK(1)); + tvi.hItem = hItem; + TreeView_SetItem(hTreeControl, &tvi); + if (expandFlags & 8) { + TreeView_Expand(hTreeControl, hItem, TVE_EXPAND); + } + + tvis.item.pszText = TranslateT("Default Window Flashing"); + hItem = TreeView_InsertItem(hTreeControl, &tvis); + bCheckParent = 1; + bCheckParent &= addOption(hTreeControl, hItem, "Messages", ChatWindow::FLAG_FLASH_MESSAGES); + bCheckParent &= addOption(hTreeControl, hItem, "User has joined", ChatWindow::FLAG_FLASH_JOINED); + bCheckParent &= addOption(hTreeControl, hItem, "User has left", ChatWindow::FLAG_FLASH_LEFT); + bCheckParent &= addOption(hTreeControl, hItem, "Topic changes", ChatWindow::FLAG_FLASH_TOPIC); + tvi.state = (bCheckParent ? INDEXTOSTATEIMAGEMASK(2) : INDEXTOSTATEIMAGEMASK(1)); + tvi.hItem = hItem; + TreeView_SetItem(hTreeControl, &tvi); + if (expandFlags & 16) { + TreeView_Expand(hTreeControl, hItem, TVE_EXPAND); + } + + CheckDlgButton(hwndDlg, IDC_SENDONENTER, Options::getChatWindowOptions() & ChatWindow::FLAG_OPT_SENDONENTER); + CheckDlgButton(hwndDlg, IDC_ENABLEIEVIEW, Options::getChatWindowOptions() & ChatWindow::FLAG_OPT_ENABLEIEVIEW); + if (!ServiceExists(MS_IEVIEW_WINDOW)) { + EnableWindow(GetDlgItem(hwndDlg, IDC_ENABLEIEVIEW), FALSE); + } + CheckDlgButton(hwndDlg, IDC_USETABS, Options::getChatContainerOptions() & ChatContainer::FLAG_USE_TABS); + + } + case WM_MEASUREITEM: + if (wParam == IDC_FONTLIST) { + MEASUREITEMSTRUCT *lpMis = (MEASUREITEMSTRUCT *) lParam; + HFONT hFont, hoFont; + HDC hDC; + SIZE fontSize; + int iItem = lpMis->itemData - 1; + Font *font = Options::getFontSettings(iItem); + if (font != NULL) { + + LPTSTR lps1 = Utils::mucc_mir_a2t(font->getFace()); + hFont = CreateFont(font->getSize(), 0, 0, 0, + font->getStyle() & Font::BOLD ? FW_BOLD : FW_NORMAL, + font->getStyle() & Font::ITALIC ? 1 : 0, 0, 0, + font->getCharSet(), + OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, lps1); + Utils::mucc_mir_free(lps1); + + hDC = GetDC(GetDlgItem(hwndDlg, lpMis->CtlID)); + hoFont = (HFONT) SelectObject(hDC, hFont); + pszText = Translate(Options::getFontSettings(iItem)->getName()); + LPTSTR pszTextT1 = Utils::mucc_mir_a2t(pszText); + GetTextExtentPoint32(hDC, pszTextT1, lstrlen(pszTextT1), &fontSize); + Utils::mucc_mir_free(pszTextT1); + SelectObject(hDC, hoFont); + ReleaseDC(GetDlgItem(hwndDlg, lpMis->CtlID), hDC); + DeleteObject(hFont); + lpMis->itemWidth = fontSize.cx; + lpMis->itemHeight = fontSize.cy; + return TRUE; + } + break; + } + case WM_DRAWITEM: + if (wParam == IDC_FONTLIST) { + DRAWITEMSTRUCT *lpDis = (DRAWITEMSTRUCT *) lParam; + HFONT hFont; + HBRUSH hBrush; + int iItem = lpDis->itemData - 1; + Font *font = Options::getFontSettings(iItem); + if (font != NULL) { + COLORREF color = (COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLORBKG, CPM_GETCOLOUR, 0, 0); + if (iItem == Options::FONT_USERLIST || iItem == Options::FONT_USERLISTGROUP) { + color = (COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLORLIST, CPM_GETCOLOUR, 0, 0); + } else if (iItem == Options::FONT_TYPING) { + color = (COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLORINPUT, CPM_GETCOLOUR, 0, 0); + } + hBrush = CreateSolidBrush(color); + + LPTSTR lps2 = Utils::mucc_mir_a2t(font->getFace()); + hFont = CreateFont(font->getSize(), 0, 0, 0, + font->getStyle() & Font::BOLD ? FW_BOLD : FW_NORMAL, + font->getStyle() & Font::ITALIC ? 1 : 0, + font->getStyle() & Font::UNDERLINE ? 1 : 0, 0, + font->getCharSet(), + OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, + lps2); + Utils::mucc_mir_free(lps2); + + hFont = (HFONT) SelectObject(lpDis->hDC, hFont); + SetBkMode(lpDis->hDC, TRANSPARENT); + FillRect(lpDis->hDC, &lpDis->rcItem, hBrush); + if (lpDis->itemState & ODS_SELECTED) { + FrameRect(lpDis->hDC, &lpDis->rcItem, GetSysColorBrush(COLOR_HIGHLIGHT)); + } + SetTextColor(lpDis->hDC, font->getColor()); + pszText = Translate(font->getName()); + LPTSTR pszTextT2 = Utils::mucc_mir_a2t(pszText); + TextOut(lpDis->hDC, lpDis->rcItem.left, lpDis->rcItem.top, pszTextT2, lstrlen(pszTextT2)); + Utils::mucc_mir_free(pszTextT2); + hFont = (HFONT) SelectObject(lpDis->hDC, hFont); + DeleteObject(hBrush); + DeleteObject(hFont); + } + return TRUE; + } + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_COLORTXT: + { + int totalCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETCOUNT, 0, 0); + int *selItems= new int[totalCount]; + int selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, totalCount, (LPARAM) selItems); + COLORREF color = (COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLORTXT, CPM_GETCOLOUR, 0, 0); + for (int i=0; isetColor(color); + } + } + delete selItems; + InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, FALSE); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + } + break; + case IDC_LOGLIMIT: + if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam==GetFocus()) { + i = GetDlgItemInt(hwndDlg, IDC_LOGLIMIT, NULL, FALSE); + // if (i>1000) { + // i = 1000; + // SetDlgItemInt(hwndDlg, IDC_LOGLIMIT, i, FALSE); + // } + if (i!=Options::getLogLimit()) { + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + } + } + break; + case IDC_COLORBKG: + case IDC_COLORLIST: + case IDC_COLORINPUT: + InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, FALSE); + case IDC_SENDONENTER: + case IDC_USETABS: + case IDC_ENABLEIEVIEW: + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case IDC_FONTLIST: + if (HIWORD(wParam) == LBN_SELCHANGE) { + if (SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0) > 1) { + SendDlgItemMessage(hwndDlg, IDC_COLORTXT, CPM_SETCOLOUR, 0, GetSysColor(COLOR_3DFACE)); + SendDlgItemMessage(hwndDlg, IDC_COLORTXT, CPM_SETDEFAULTCOLOUR, 0, GetSysColor(COLOR_WINDOWTEXT)); + } + else { + int iItem = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, + SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETCURSEL, 0, 0), 0) - 1; + Font *font = Options::getFontSettings(iItem); + if (font != NULL) { + SendDlgItemMessage(hwndDlg, IDC_COLORTXT, CPM_SETCOLOUR, 0, font->getColor()); + SendDlgItemMessage(hwndDlg, IDC_COLORTXT, CPM_SETDEFAULTCOLOUR, 0, font->getColor()); + } + } + } + if (HIWORD(wParam) != LBN_DBLCLK) { + return TRUE; + } + case IDC_CHOOSEFONT: + { + CHOOSEFONT cf; + LOGFONT lf; + int iItem = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETCURSEL, 0, 0), 0) - 1; + ZeroMemory(&cf, sizeof(cf)); + ZeroMemory(&lf, sizeof(lf)); + Font *font = Options::getFontSettings(iItem); + if (font != NULL) { + lf.lfHeight = font->getSize(); + lf.lfWeight = font->getStyle() & Font::BOLD ? FW_BOLD : FW_NORMAL; + lf.lfItalic = font->getStyle() & Font::ITALIC ? 1 : 0; + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfOutPrecision = OUT_DEFAULT_PRECIS; + lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; + lf.lfQuality = DEFAULT_QUALITY; + lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; + LPTSTR lps3 = Utils::mucc_mir_a2t(font->getFace()); + lstrcpy(lf.lfFaceName, lps3); + Utils::mucc_mir_free(lps3); + cf.lStructSize = sizeof(cf); + cf.hwndOwner = hwndDlg; + cf.lpLogFont = &lf; + cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS; + if (ChooseFont(&cf)) { + int totalCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETCOUNT, 0, 0); + int *selItems= new int[totalCount]; + int selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, totalCount, (LPARAM) selItems); + for (int i=0; isetStyle((lf.lfWeight >= FW_BOLD ? Font::BOLD : 0) | (lf.lfItalic ? Font::ITALIC : 0)); + font2->setCharSet(lf.lfCharSet); + font2->setSize(lf.lfHeight); + char* lps4 = Utils::mucc_mir_t2a(lf.lfFaceName); + font2->setFace(lps4); + Utils::mucc_mir_free(lps4); + MEASUREITEMSTRUCT mis; + ZeroMemory(&mis, sizeof(mis)); + mis.CtlID = IDC_FONTLIST; + mis.itemData = iItem + 1; + SendMessage(hwndDlg, WM_MEASUREITEM, (WPARAM)IDC_FONTLIST, (LPARAM) & mis); + SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_SETITEMHEIGHT, selItems[i], mis.itemHeight); + } + } + delete selItems; + InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, TRUE); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + } + } + return TRUE; + } + break; + } + break; + case WM_DESTROY: + Options::setExpandFlags(getExpandFlags(GetDlgItem(hwndDlg, IDC_TREELIST))); + break; + case WM_NOTIFY: + { + switch (((LPNMHDR) lParam)->code) { + case PSN_APPLY: + COLORREF color; + color = (COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLORLIST, CPM_GETCOLOUR, 0, 0); + Options::setListBgColor(color); + color = (COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLORINPUT, CPM_GETCOLOUR, 0, 0); + Options::setInputBgColor(color); + color = (COLORREF) SendDlgItemMessage(hwndDlg, IDC_COLORBKG, CPM_GETCOLOUR, 0, 0); + Options::setLogBgColor(color); + Options::setLogLimit(SendDlgItemMessage(hwndDlg, IDC_LOGLIMITSPIN, UDM_GETPOS, 0, 0)); + Options::setChatWindowOptions(getOptions(GetDlgItem(hwndDlg, IDC_TREELIST), TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREELIST)), 0)); + Options::setChatWindowOptions(Options::getChatWindowOptions() | (IsDlgButtonChecked(hwndDlg, IDC_SENDONENTER) ? ChatWindow::FLAG_OPT_SENDONENTER : 0)); + Options::setChatWindowOptions(Options::getChatWindowOptions() | (IsDlgButtonChecked(hwndDlg, IDC_ENABLEIEVIEW) ? ChatWindow::FLAG_OPT_ENABLEIEVIEW : 0)); + Options::setChatContainerOptions(IsDlgButtonChecked(hwndDlg, IDC_USETABS) ? ChatContainer::FLAG_USE_TABS : 0); + Options::saveSettings(); + ChatWindow::refreshSettings(1); + break; + case NM_CLICK: + /* Handle checking/unchecking options here - update children and parent appropriately */ + if(((LPNMHDR)lParam)->idFrom == IDC_TREELIST) { + TVHITTESTINFO hti; + hti.pt.x = (short)LOWORD(GetMessagePos()); + hti.pt.y = (short)HIWORD(GetMessagePos()); + ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt); + if(TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti)) { + if(hti.flags&TVHT_ONITEMSTATEICON) { + TVITEM tvi = {0}; + tvi.mask = TVIF_HANDLE | TVIF_STATE; + tvi.stateMask = TVIS_STATEIMAGEMASK; + tvi.hItem = hti.hItem; + TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi); + tvi.state ^= INDEXTOSTATEIMAGEMASK(3); + tvi.hItem = TreeView_GetChild(((LPNMHDR)lParam)->hwndFrom, hti.hItem); + if (tvi.hItem!=NULL) { + while(tvi.hItem != NULL) { + TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi); + tvi.hItem=TreeView_GetNextSibling(((LPNMHDR)lParam)->hwndFrom, tvi.hItem); + } + } else { + HTREEITEM hParent = TreeView_GetParent(((LPNMHDR)lParam)->hwndFrom, hti.hItem); + if (hParent != NULL) { + if ((tvi.state>>12) == 2) { + tvi.hItem = TreeView_GetNextSibling(((LPNMHDR)lParam)->hwndFrom, hti.hItem); + while(tvi.hItem != NULL) { + TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi); + if ((tvi.state>>12) != 2) { + break; + } + tvi.hItem = TreeView_GetNextSibling(((LPNMHDR)lParam)->hwndFrom, tvi.hItem); + } + if ((tvi.state>>12) == 2) { + tvi.hItem = TreeView_GetPrevSibling(((LPNMHDR)lParam)->hwndFrom, hti.hItem); + while(tvi.hItem != NULL) { + TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi); + if ((tvi.state>>12) != 2) { + break; + } + tvi.hItem = TreeView_GetPrevSibling(((LPNMHDR)lParam)->hwndFrom, tvi.hItem); + } + } + } + tvi.hItem = hParent; + TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi); + } + } + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + } + } + } + break; + } + } + break; + } + return FALSE; +} + +/* +#define POPUP_DEFAULT_COLORBKG 0xDCBDA5 +#define POPUP_DEFAULT_COLORTXT 0x000000 +static void MailPopupPreview(DWORD colorBack, DWORD colorText, char *title, char *emailInfo, int delay) +{ + POPUPDATAEX ppd; + char * lpzContactName; + char * lpzText; + + lpzContactName = title; + lpzText = emailInfo; + ZeroMemory(&ppd, sizeof(ppd)); + ppd.lchContact = NULL; + ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_MAIL)); + lstrcpy(ppd.lpzContactName, lpzContactName); + lstrcpy(ppd.lpzText, lpzText); + ppd.colorBack = colorBack; + ppd.colorText = colorText; + ppd.PluginWindowProc = NULL; + ppd.PluginData=NULL; + if ( ServiceExists( MS_POPUP_ADDPOPUPEX )) { + ppd.iSeconds = delay; + CallService(MS_POPUP_ADDPOPUPEX, (WPARAM)&ppd, 0); + + } + else if ( ServiceExists( MS_POPUP_ADDPOPUP )) { + CallService(MS_POPUP_ADDPOPUP, (WPARAM)&ppd, 0); + } +} +*/ +//static INT_PTR CALLBACK MUCCPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +//{ + /* + switch (msg) { + case WM_INITDIALOG: + { + BYTE delayMode; + CheckDlgButton(hwndDlg, IDC_ENABLEPOPUP, DBGetContactSettingByte(NULL, jabberProtoName, "MailPopupEnabled", TRUE)); + SendDlgItemMessage(hwndDlg, IDC_COLORBKG, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, jabberProtoName, "MailPopupBack", POPUP_DEFAULT_COLORBKG)); + SendDlgItemMessage(hwndDlg, IDC_COLORTXT, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, jabberProtoName, "MailPopupText", POPUP_DEFAULT_COLORTXT)); + SetDlgItemInt(hwndDlg, IDC_DELAY, DBGetContactSettingDword(NULL, jabberProtoName, "MailPopupDelay", 4), FALSE); + delayMode = DBGetContactSettingByte(NULL, jabberProtoName, "MailPopupDelayMode", 0); + if (delayMode==1) { + CheckDlgButton(hwndDlg, IDC_DELAY_CUSTOM, TRUE); + } else if (delayMode==2) { + CheckDlgButton(hwndDlg, IDC_DELAY_PERMANENT, TRUE); + } else { + CheckDlgButton(hwndDlg, IDC_DELAY_POPUP, TRUE); + } + return TRUE; + } + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_COLORTXT: + case IDC_COLORBKG: + case IDC_ENABLEPOPUP: + case IDC_DELAY: + case IDC_DELAY_POPUP: + case IDC_DELAY_CUSTOM: + case IDC_DELAY_PERMANENT: + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case IDC_PREVIEW: + { + int delay; + if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_POPUP)) { + delay=0; + } else if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_PERMANENT)) { + delay=-1; + } else { + delay=GetDlgItemInt(hwndDlg, IDC_DELAY, NULL, FALSE); + } + MailPopupPreview((DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORBKG,CPM_GETCOLOUR,0,0), + (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORTXT,CPM_GETCOLOUR,0,0), + "New mail", + "From: test@test.test\nSubject: test", + delay); + } + + } + break; + + + case WM_NOTIFY: + switch (((LPNMHDR) lParam)->code) { + case PSN_APPLY: + { + BYTE delayMode; + DBWriteContactSettingByte(NULL, jabberProtoName, "MailPopupEnabled", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ENABLEPOPUP)); + DBWriteContactSettingDword(NULL, jabberProtoName, "MailPopupBack", (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORBKG,CPM_GETCOLOUR,0,0)); + DBWriteContactSettingDword(NULL, jabberProtoName, "MailPopupText", (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORTXT,CPM_GETCOLOUR,0,0)); + DBWriteContactSettingDword(NULL, jabberProtoName, "MailPopupDelay", (DWORD) GetDlgItemInt(hwndDlg,IDC_DELAY, NULL, FALSE)); + delayMode=0; + if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_CUSTOM)) { + delayMode=1; + } else if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_PERMANENT)) { + delayMode=2; + + } + DBWriteContactSettingByte(NULL, jabberProtoName, "MailPopupDelayMode", delayMode); + return TRUE; + } + } + break; + + }*/ +// return FALSE; +//} + diff --git a/!NotAdopted/Tlen/tlen_czaty/Options.h b/!NotAdopted/Tlen/tlen_czaty/Options.h new file mode 100644 index 0000000000..90c57099d0 --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/Options.h @@ -0,0 +1,75 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +#ifndef OPTIONS_INCLUDED +#define OPTIONS_INCLUDED +#include "FontList.h" +#include "mucc.h" + +extern int MUCCOptInit(WPARAM wParam, LPARAM lParam); + +class Options:public FontList { +private: + static COLORREF colorInputBg; + static COLORREF colorLogBg; + static COLORREF colorListBg; + static HBRUSH brushInputBg; + static HBRUSH brushLogBg; + static HBRUSH brushListBg; + static int logLimit; + static int chatContainerOptions; + static int chatWindowOptions; + static COLORREF chatWindowFontColor; + static int chatWindowFont; + static int chatWindowFontSize; + static int chatWindowFontStyle; +public: + static void setListBgColor(COLORREF c); + static void setLogBgColor(COLORREF c); + static void setInputBgColor(COLORREF c); + static COLORREF getListBgColor(); + static COLORREF getLogBgColor(); + static COLORREF getInputBgColor(); + static HBRUSH getListBgBrush(); + static HBRUSH getInputBgBrush(); + static HBRUSH getLogBgBrush(); + static void setLogLimit(int l); + static int getLogLimit(); + static void setChatContainerOptions(int o); + static int getChatContainerOptions(); + static void setChatWindowOptions(int o); + static int getChatWindowOptions(); + static void setChatWindowFontColor(COLORREF o); + static COLORREF getChatWindowFontColor(); + static void setChatWindowFont(int o); + static int getChatWindowFont(); + static void setChatWindowFontSize(int o); + static int getChatWindowFontSize(); + static void setChatWindowFontStyle(int o); + static int getChatWindowFontStyle(); + static void setExpandFlags(int l); + static int getExpandFlags(); + static void init(); + static void loadSettings(); + static void saveSettings(); + +}; + +#endif diff --git a/!NotAdopted/Tlen/tlen_czaty/Utils.cpp b/!NotAdopted/Tlen/tlen_czaty/Utils.cpp new file mode 100644 index 0000000000..53bddf4488 --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/Utils.cpp @@ -0,0 +1,138 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +#include "Utils.h" + +struct FORK_ARG { + HANDLE hEvent; + void (__cdecl *threadcode)(void*); + void *arg; +}; + +static void __cdecl forkthread_r(struct FORK_ARG *fa) +{ + void (*callercode)(void*) = fa->threadcode; + void *arg = fa->arg; + CallService(MS_SYSTEM_THREAD_PUSH, 0, 0); + SetEvent(fa->hEvent); + callercode(arg); + CallService(MS_SYSTEM_THREAD_POP, 0, 0); + return; +} + +unsigned long Utils::forkThread(void (__cdecl *threadcode)(void*), unsigned long stacksize, void *arg) { + + unsigned long rc; + struct FORK_ARG fa; + + fa.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + fa.threadcode = threadcode; + fa.arg = arg; + rc = _beginthread((void (__cdecl *)(void*))forkthread_r, stacksize, &fa); + if ((unsigned long) -1L != rc) { + WaitForSingleObject(fa.hEvent, INFINITE); + } + CloseHandle(fa.hEvent); + return rc; +} + +void Utils::copyString(char **a, const char *b) { + char *oldA; + char *newA; + oldA = *a; + if (b!=NULL) { + newA = new char[strlen(b)+1]; + strcpy(newA, b); + } else { + newA = NULL; + } + *a = newA; + if (oldA!=NULL) { + delete oldA; + } + +} + + + +MM_INTERFACE Utils::mmi; + +void Utils::mucc_mir_free(void* ptr) +{ + mir_free(ptr); +} + +char* Utils::mucc_mir_t2a(LPCTSTR src) +{ + return mir_t2a(src); +} + +LPTSTR Utils::mucc_mir_a2t(const char* src) +{ + return mir_a2t(src); +} + + + +void Utils::log(const char *fmt, ...) +{ +#ifdef ENABLE_LOGGING + char *str; + va_list vararg; + int strsize; + char *text; + char *p, *q; + int extra; + + va_start(vararg, fmt); + str = (char *) malloc(strsize=2048); + while (_vsnprintf(str, strsize, fmt, vararg) == -1) + str = (char *) realloc(str, strsize+=2048); + va_end(vararg); + + extra = 0; + for (p=str; *p!='\0'; p++) + if (*p=='\n' || *p=='\r') + extra++; + text = (char *) malloc(strlen(muccModuleName)+2+strlen(str)+2+extra); + wsprintf(text, "[%s]", muccModuleName); + for (p=str,q=text+strlen(text); *p!='\0'; p++,q++) { + if (*p == '\r') { + *q = '\\'; + *(q+1) = 'r'; + q++; + } + else if (*p == '\n') { + *q = '\\'; + *(q+1) = 'n'; + q++; + } + else + *q = *p; + } + *q = '\n'; + *(q+1) = '\0'; +// CallService(MS_NETLIB_LOG, (WPARAM) NULL, (LPARAM) text); + //OutputDebugString(text); + free(text); + free(str); +#endif +} + diff --git a/!NotAdopted/Tlen/tlen_czaty/Utils.h b/!NotAdopted/Tlen/tlen_czaty/Utils.h new file mode 100644 index 0000000000..6ae4e2a44c --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/Utils.h @@ -0,0 +1,38 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +#ifndef UTILS_INCLUDED +#define UTILS_INCLUDED +#include "mucc.h" + +class Utils { +public: + static unsigned long forkThread(void (__cdecl *threadcode)(void*),unsigned long stacksize,void *arg); + static void copyString(char **, const char *b); + static void log(const char *fmt, ...); + + static MM_INTERFACE mmi; + static void mucc_mir_free(void*); + static char* mucc_mir_t2a(LPCTSTR); + static LPTSTR mucc_mir_a2t(const char* ); + +}; + +#endif diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/admin.ico b/!NotAdopted/Tlen/tlen_czaty/icos/admin.ico new file mode 100644 index 0000000000..9699f55d6f Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/admin.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/administration.ico b/!NotAdopted/Tlen/tlen_czaty/icos/administration.ico new file mode 100644 index 0000000000..e57884857e Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/administration.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/blank.ico b/!NotAdopted/Tlen/tlen_czaty/icos/blank.ico new file mode 100644 index 0000000000..7845f62fed Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/blank.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/bold.ico b/!NotAdopted/Tlen/tlen_czaty/icos/bold.ico new file mode 100644 index 0000000000..01d5adda1d Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/bold.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/chat.ico b/!NotAdopted/Tlen/tlen_czaty/icos/chat.ico new file mode 100644 index 0000000000..0b388d8f9d Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/chat.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/delete.ico b/!NotAdopted/Tlen/tlen_czaty/icos/delete.ico new file mode 100644 index 0000000000..59408c5337 Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/delete.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/glowner.ico b/!NotAdopted/Tlen/tlen_czaty/icos/glowner.ico new file mode 100644 index 0000000000..86fdf534e9 Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/glowner.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/invite.ico b/!NotAdopted/Tlen/tlen_czaty/icos/invite.ico new file mode 100644 index 0000000000..bf7dbc4d7a Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/invite.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/italic.ico b/!NotAdopted/Tlen/tlen_czaty/icos/italic.ico new file mode 100644 index 0000000000..d34418be24 Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/italic.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/message.ico b/!NotAdopted/Tlen/tlen_czaty/icos/message.ico new file mode 100644 index 0000000000..40d183b7b3 Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/message.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/next.ico b/!NotAdopted/Tlen/tlen_czaty/icos/next.ico new file mode 100644 index 0000000000..d817b06cc6 Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/next.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/options.ico b/!NotAdopted/Tlen/tlen_czaty/icos/options.ico new file mode 100644 index 0000000000..2fd2d902d9 Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/options.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/owner.ico b/!NotAdopted/Tlen/tlen_czaty/icos/owner.ico new file mode 100644 index 0000000000..27bea391f0 Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/owner.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/prev.ico b/!NotAdopted/Tlen/tlen_czaty/icos/prev.ico new file mode 100644 index 0000000000..2f171e5783 Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/prev.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/r_anon.ico b/!NotAdopted/Tlen/tlen_czaty/icos/r_anon.ico new file mode 100644 index 0000000000..b5ebd0289e Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/r_anon.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/r_memb.ico b/!NotAdopted/Tlen/tlen_czaty/icos/r_memb.ico new file mode 100644 index 0000000000..418fd9abf5 Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/r_memb.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/r_mod.ico b/!NotAdopted/Tlen/tlen_czaty/icos/r_mod.ico new file mode 100644 index 0000000000..3b9fa47f60 Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/r_mod.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/registered.ico b/!NotAdopted/Tlen/tlen_czaty/icos/registered.ico new file mode 100644 index 0000000000..3a5182b5d6 Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/registered.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/save.ico b/!NotAdopted/Tlen/tlen_czaty/icos/save.ico new file mode 100644 index 0000000000..48b0581fd5 Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/save.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/search.ico b/!NotAdopted/Tlen/tlen_czaty/icos/search.ico new file mode 100644 index 0000000000..065468e272 Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/search.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/sendmail.ico b/!NotAdopted/Tlen/tlen_czaty/icos/sendmail.ico new file mode 100644 index 0000000000..0b60bf950e Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/sendmail.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/smile.ico b/!NotAdopted/Tlen/tlen_czaty/icos/smile.ico new file mode 100644 index 0000000000..d4aea87249 Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/smile.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/tlenbig.ico b/!NotAdopted/Tlen/tlen_czaty/icos/tlenbig.ico new file mode 100644 index 0000000000..4d09293560 Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/tlenbig.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/tlensmall.ico b/!NotAdopted/Tlen/tlen_czaty/icos/tlensmall.ico new file mode 100644 index 0000000000..5204d39d21 Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/tlensmall.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/icos/underline.ico b/!NotAdopted/Tlen/tlen_czaty/icos/underline.ico new file mode 100644 index 0000000000..7709f5f7f4 Binary files /dev/null and b/!NotAdopted/Tlen/tlen_czaty/icos/underline.ico differ diff --git a/!NotAdopted/Tlen/tlen_czaty/mucc.cpp b/!NotAdopted/Tlen/tlen_czaty/mucc.cpp new file mode 100644 index 0000000000..e5c35c070a --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/mucc.cpp @@ -0,0 +1,188 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#include "../commons.h" +#include "mucc.h" +#include "mucc_services.h" +#include "HelperDialog.h" +#include "Options.h" +#include "Utils.h" + +char *muccModuleName; +HINSTANCE hInst; +PLUGINLINK *pluginLink; +HANDLE hHookEvent = NULL; +HIMAGELIST hImageList = NULL; +HICON muccIcon[MUCC_ICON_TOTAL]; +static int ModulesLoaded(WPARAM wParam, LPARAM lParam); +static int PreShutdown(WPARAM wParam, LPARAM lParam); + +PLUGININFOEX pluginInfoEx = { + sizeof(PLUGININFOEX), +#ifdef _UNICODE +#ifdef _X64 + "Tlen Czaty (x64, Unicode)", +#else + "Tlen Czaty (Unicode)", +#endif +#else + "Tlen Czaty", +#endif + PLUGIN_MAKE_VERSION(MUCC_MAJOR_VERSION,MUCC_MINOR_VERSION,MUCC_RELEASE_NUM,MUCC_BUILD_NUM), + "Group chats GUI plugin for Miranda IM (formerly known as mucc.dll) (version: "MUCC_VERSION_STRING" ; compiled: "__DATE__" "__TIME__")", + "Piotr Piastucki", + "the_leech@users.berlios.de", + "(c) 2004-2012 Piotr Piastucki", + "http://mtlen.berlios.de", + 0, + 0, +#if defined( _UNICODE ) +#ifdef _X64 + {0x9061ae31, 0x3d33, 0x49ce, { 0xaf, 0x00, 0x78, 0x9c, 0xbc, 0x25, 0xd9, 0xba }} +#else + {0xadd9390c, 0x1dd4, 0x4c0d, { 0x9b, 0xa9, 0xcc, 0x76, 0x5d, 0x3d, 0xe5, 0x97 }} +#endif +#else + {0x5cf4792c, 0xa050, 0x46b6, { 0xaf, 0xd0, 0x03, 0x2d, 0x6e, 0xfc, 0xd3, 0x9c }} +#endif +}; + +extern "C" BOOL WINAPI DllMain(HINSTANCE hModule, DWORD dwReason, LPVOID lpvReserved) +{ + hInst = hModule; + return TRUE; +} + +extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion) +{ + if (mirandaVersion < PLUGIN_MAKE_VERSION(0,8,0,15)) { + MessageBox(NULL, _TEXT("The Tlen Czaty plugin cannot be loaded. It requires Miranda IM 0.8.15 or later."), _TEXT("Tlen Czaty plugin (MUCC)"), MB_OK|MB_ICONWARNING|MB_SETFOREGROUND|MB_TOPMOST); + return NULL; + } + return &pluginInfoEx; +} + +#ifndef MIID_TLEN_MUCC +#define MIID_TLEN_MUCC { 0xba658997, 0x0bce, 0x4f96, { 0xba, 0x48, 0x54, 0x55, 0x34, 0x16, 0x73, 0xea } } +#endif + +extern "C" __declspec(dllexport) const MUUID interfaces[] = { + MIID_TLEN_MUCC, + MIID_LAST + }; + +extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) +{ + return interfaces; +} + + +static void LoadIcons() { + int i; + static int iconList[] = { + IDI_CHAT, + IDI_GLOBALOWNER, + IDI_OWNER, + IDI_ADMIN, + IDI_REGISTERED, + IDI_R_MODERATED, + IDI_R_MEMBERS, + IDI_R_ANONYMOUS, + IDI_PREV, + IDI_NEXT, + IDI_SEARCH, + IDI_BOLD, + IDI_ITALIC, + IDI_UNDERLINE, + IDI_OPTIONS, + IDI_INVITE, + IDI_ADMINISTRATION, + IDI_SMILEY, + IDI_MESSAGE + + }; + for (i=0; i +#include +#include +#include +#include +#include +#include +#include + +#ifdef __MINGW32__ +#define EM_SETTEXTEX (WM_USER + 97) +#define ST_DEFAULT 0 +#define ST_KEEPUNDO 1 +#define ST_SELECTION 2 +#define ST_NEWCHARS 4 +#else +#include +#endif + +#define MIRANDA_VER 0x0700 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "resource.h" + +enum { + MUCC_IDI_CHAT = 0, + MUCC_IDI_U_GLOBALOWNER, + MUCC_IDI_U_OWNER, + MUCC_IDI_U_ADMIN, + MUCC_IDI_U_REGISTERED, + MUCC_IDI_R_MODERATED, + MUCC_IDI_R_MEMBERS, + MUCC_IDI_R_ANONYMOUS, + MUCC_IDI_PREV, + MUCC_IDI_NEXT, + MUCC_IDI_SEARCH, + MUCC_IDI_BOLD, + MUCC_IDI_ITALIC, + MUCC_IDI_UNDERLINE, + MUCC_IDI_OPTIONS, + MUCC_IDI_INVITE, + MUCC_IDI_ADMINISTRATION, + MUCC_IDI_SMILEY, + MUCC_IDI_MESSAGE, + MUCC_ICON_TOTAL + +}; + +extern PLUGINLINK * pluginLink; +extern char *muccModuleName; +extern HINSTANCE hInst; +extern HANDLE hHookEvent; +extern HIMAGELIST hImageList; +extern HICON muccIcon[MUCC_ICON_TOTAL]; + +#include "m_mucc.h" + +#define WM_MUCC_REFRESH_ROOMS (WM_USER+101) +#define WM_MUCC_REFRESH_USER_ROOMS (WM_USER+102) +#define WM_MUCC_REFRESH_USER_NICKS (WM_USER+103) + +#endif + diff --git a/!NotAdopted/Tlen/tlen_czaty/mucc.rc b/!NotAdopted/Tlen/tlen_czaty/mucc.rc new file mode 100644 index 0000000000..d50a834649 --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/mucc.rc @@ -0,0 +1,579 @@ +#include "resource.h" +#include "../commons.h" +#ifdef __MINGW32__ + #define WINVER 0x500 + #define _WIN32_IE 0x500 + #include + #ifndef IDC_STATIC + #define IDC_STATIC (-1) +#endif +#else +// #define APSTUDIO_READONLY_SYMBOLS +// #include "winres.h" +// #undef APSTUDIO_READONLY_SYMBOLS + #include + #ifndef IDC_STATIC + #define IDC_STATIC (-1) + #endif +#endif +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif +#ifdef APSTUDIO_INVOKED + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +IDR_CHATOPTIONS MENU DISCARDABLE +BEGIN + POPUP "", MENUBREAK + BEGIN + POPUP "Log Appearance" + BEGIN + MENUITEM "Show Nicknames", ID_OPTIONMENU_SHOWNICKNAMES + MENUITEM "Show Message On A New Line", ID_OPTIONMENU_MSGINNEWLINE + END + POPUP "Timestamp Settings" + BEGIN + MENUITEM "Show Date", ID_OPTIONMENU_SHOWDATE + MENUITEM "Show Timestamp", ID_OPTIONMENU_SHOWTIMESTAMP + MENUITEM "Show Seconds", ID_OPTIONMENU_SHOWSECONDS + MENUITEM "Use Long Date Format", ID_OPTIONMENU_USELONGDATE + + END + POPUP "Text Formatting Filter" + BEGIN + MENUITEM "Font Name", ID_OPTIONMENU_FORMATFONT + MENUITEM "Font Size", ID_OPTIONMENU_FORMATSIZE + MENUITEM "Font Style", ID_OPTIONMENU_FORMATSTYLE + MENUITEM "Font Color", ID_OPTIONMENU_FORMATCOLOR + END + POPUP "Event Filter" + BEGIN + MENUITEM "Messages", ID_OPTIONMENU_LOGMESSAGES + MENUITEM "User Has Joined", ID_OPTIONMENU_LOGJOINED + MENUITEM "User Has Left", ID_OPTIONMENU_LOGLEFT + MENUITEM "Topic Changes", ID_OPTIONMENU_LOGTOPIC + END + POPUP "Window Flashing" + BEGIN + MENUITEM "Messages", ID_OPTIONMENU_FLASHMESSAGES + MENUITEM "User Has Joined", ID_OPTIONMENU_FLASHJOINED + MENUITEM "User Has Left", ID_OPTIONMENU_FLASHLEFT + MENUITEM "Topic Changes", ID_OPTIONMENU_FLASHTOPIC + END + MENUITEM SEPARATOR + MENUITEM "Save Settings As Default", ID_OPTIONMENU_SAVEDEFAULT + MENUITEM SEPARATOR + MENUITEM "User Administration", ID_ADMINMENU_ADMIN, GRAYED + MENUITEM "Destroy Chat Room", ID_ADMINMENU_DESTROY, GRAYED + MENUITEM SEPARATOR + MENUITEM "Save Log", ID_ADMINMENU_SAVELOG + END + POPUP "", MENUBREAK + BEGIN + MENUITEM "Message", ID_USERMENU_MESSAGE + MENUITEM SEPARATOR + POPUP "Kick && Ban", GRAYED + BEGIN + MENUITEM "No Ban", ID_USERMENU_KICK_NO_BAN + MENUITEM "Ban For 1 Minute", ID_USERMENU_KICK_BAN_1_MIN + MENUITEM "Ban For 5 Minutes", ID_USERMENU_KICK_BAN_5_MIN + MENUITEM "Ban For 15 Minutes", ID_USERMENU_KICK_BAN_15_MIN + MENUITEM "Ban For 30 Minutes", ID_USERMENU_KICK_BAN_15_MIN + MENUITEM "Ban For 1 Hour", ID_USERMENU_KICK_BAN_1_H + MENUITEM "Ban For 6 Hours", ID_USERMENU_KICK_BAN_6_H + MENUITEM "Ban For 1 Day", ID_USERMENU_KICK_BAN_1_D + MENUITEM "Ban For 3 Days", ID_USERMENU_KICK_BAN_3_D + MENUITEM "Ban For 1 Week", ID_USERMENU_KICK_BAN_1_W + MENUITEM "Ban For 2 Weeks", ID_USERMENU_KICK_BAN_2_W + MENUITEM "Ban For 4 Weeks", ID_USERMENU_KICK_BAN_4_W + END + POPUP "Change User Role", GRAYED + BEGIN + MENUITEM "No Role", ID_USERMENU_RIGHTS_NO + MENUITEM "Member", ID_USERMENU_RIGHTS_MEMBER + + MENUITEM "Admin", ID_USERMENU_RIGHTS_ADMIN + END + MENUITEM "User Administration", ID_USERMENU_ADMINISTRATION, GRAYED + END + POPUP "", MENUBREAK + BEGIN + MENUITEM "Unban", ID_USERMENU_UNBAN + END +END + +IDR_CONTEXT MENU DISCARDABLE +BEGIN + POPUP "Log" + BEGIN + MENUITEM "&Copy", IDM_COPY + MENUITEM "Co&py All", IDM_COPYALL + MENUITEM SEPARATOR + MENUITEM "Select &All", IDM_SELECTALL + MENUITEM SEPARATOR + MENUITEM "C&lear Log", IDM_CLEAR + END + POPUP "LogLink" + BEGIN + MENUITEM "Open in &new window", IDM_OPENNEW + MENUITEM "&Open in existing window", IDM_OPENEXISTING + MENUITEM "&Copy link", IDM_COPYLINK + END + POPUP "Message" + BEGIN + MENUITEM "Undo", IDM_UNDO + MENUITEM "Redo", IDM_REDO + MENUITEM SEPARATOR + MENUITEM "Cut", IDM_CUT + MENUITEM "Copy", IDM_COPY + MENUITEM "Paste", IDM_PASTE + MENUITEM "Delete", IDM_DELETE + MENUITEM SEPARATOR + MENUITEM "Select &All", IDM_SELECTALL + END +END + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_OPTIONS DIALOGEX 0, 0, 320, 260 +STYLE DS_FIXEDSYS | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Fonts",IDC_FONTSGB,169,10,143,182 + LTEXT "Background color",IDC_STATIC,175,23,100,8 + CONTROL "",IDC_COLORBKG,"ColourPicker",WS_TABSTOP,277,21,29,12 + LTEXT "Input area background",IDC_STATIC,175,38,100,8 + CONTROL "",IDC_COLORINPUT,"ColourPicker",WS_TABSTOP,277,36,29,12 + LTEXT "User list background",IDC_STATIC,175,53,100,8 + CONTROL "",IDC_COLORLIST,"ColourPicker",WS_TABSTOP,277,51,29,12 + LISTBOX IDC_FONTLIST,175,69,131,95,LBS_OWNERDRAWVARIABLE | + LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | WS_VSCROLL | + WS_TABSTOP + CONTROL "",IDC_COLORTXT,"ColourPicker",WS_TABSTOP,175,170,55,15 + PUSHBUTTON "Choose font",IDC_CHOOSEFONT,251,170,55,15 + GROUPBOX "Options",IDC_OPTIONSGB,5,10,158,182 + CONTROL "",IDC_TREELIST,"SysTreeView32",TVS_HASBUTTONS | + TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP,11, + 23,146,162,WS_EX_STATICEDGE + GROUPBOX "Other",IDC_SIMPLE,5,193,310,57 + CONTROL "Use tabbed mode",IDC_USETABS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,206,140,10 + CONTROL "Enable IEView",IDC_ENABLEIEVIEW,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,219,140,10 + CONTROL "Send message on 'Enter'",IDC_SENDONENTER,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,232,140,10 + LTEXT "Limit log history to (events):",IDC_STATIC,153,234,110,8 + EDITTEXT IDC_LOGLIMIT,263,232,40,14,ES_RIGHT | ES_NUMBER + CONTROL "",IDC_LOGLIMITSPIN,"msctls_updown32",UDS_SETBUDDYINT | + UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | + UDS_NOTHOUSANDS | UDS_HOTTRACK,390,218,11,14 +END + +IDD_CHATMANAGER DIALOGEX 0, 0, 473, 234 +STYLE DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | + WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | + WS_THICKFRAME +EXSTYLE WS_EX_CONTROLPARENT +CAPTION "Chats" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + CONTROL "Tab1",IDC_TABS,"SysTabControl32",TCS_BUTTONS | + TCS_FIXEDWIDTH | 0x8,214,7,252,20 + PUSHBUTTON "Close",IDCLOSE,416,215,50,14 + CONTROL "Tree1",IDC_GROUP,"SysTreeView32",TVS_HASBUTTONS | + TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP | + TVS_SHOWSELALWAYS | TVS_NOTOOLTIPS,5,20,203,209, + WS_EX_STATICEDGE + LTEXT "Groups",IDC_STATIC,7,9,24,8 +END + +IDD_GROUPCHAT_CONTAINER DIALOGEX 0, 0, 300, 200 +STYLE DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | + WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | + WS_THICKFRAME +EXSTYLE WS_EX_CONTROLPARENT +CAPTION "Tlen Group Chat" +FONT 8, "MS Shell Dlg" +BEGIN + CONTROL "",IDC_TABS,"SysTabControl32", WS_CLIPSIBLINGS | TCS_MULTILINE | TCS_FOCUSNEVER | 0x8,0,0,300,200 +END + +IDD_GROUPCHAT_LOG DIALOGEX 0, 0, 294, 178 +STYLE DS_FIXEDSYS | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN +/* +STYLE DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | + WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | + WS_THICKFRAME + */ +//EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + CONTROL "",IDC_VSPLIT,"Static",SS_ENHMETAFILE,237,20,3,117 + CONTROL "",IDC_HSPLIT,"Static",SS_ENHMETAFILE,156,285,2,0 + CONTROL "",IDC_LOG,"RichEdit20A",WS_VSCROLL | WS_TABSTOP | WS_CLIPSIBLINGS | 0x844, + 3,21,233,117,WS_EX_STATICEDGE + CONTROL "",IDC_TREELIST,"SysTreeView32",TVS_DISABLEDRAGDROP | + TVS_SHOWSELALWAYS | TVS_NOTOOLTIPS | TVS_NONEVENHEIGHT,5, + 20,203,209,WS_EX_STATICEDGE + EDITTEXT IDC_EDIT,3,158,285,13,ES_MULTILINE | ES_AUTOVSCROLL | + NOT WS_BORDER | WS_VSCROLL | ES_WANTRETURN,WS_EX_STATICEDGE + CONTROL "Topic",IDC_TOPIC_BUTTON,"MButtonClass",WS_DISABLED | + WS_TABSTOP,3,3,34,12,0x18000000L + CONTROL "",IDC_BOLD,"MButtonClass",WS_TABSTOP,3,140,16,16, + 0x18000000L + CONTROL "",IDC_ITALIC,"MButtonClass",WS_TABSTOP,21,140,16,16, + 0x18000000L + CONTROL "",IDC_UNDERLINE,"MButtonClass",WS_TABSTOP,39,140,16,16, + 0x18000000L + CONTROL "",IDC_COLOR,"ColourPicker",WS_TABSTOP,57,140,16,16 + COMBOBOX IDC_FONTSIZE,154,142,27,80,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + CONTROL "",IDC_SMILEYBTN,"MButtonClass", WS_TABSTOP,185,140,16,16, + 0x18000000L + CONTROL "Invite",IDC_INVITE,"MButtonClass",WS_TABSTOP,259,141,16, + 16,0x18000000L + EDITTEXT IDC_TOPIC,70,19,86,12,ES_AUTOHSCROLL | ES_READONLY | NOT + WS_BORDER + CONTROL "",IDC_OPTIONS,"MButtonClass",WS_TABSTOP,208,140,16,16, + 0x18000000L + COMBOBOX IDC_FONT,77,142,74,90,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + PUSHBUTTON "Close",IDCANCEL,0,0,20,20,NOT WS_VISIBLE + //,NOT WS_VISIBLE +END + +IDD_HELPER_JOIN DIALOGEX 0, 0, 186, 79 +STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | + WS_POPUP | WS_VISIBLE | WS_CAPTION +EXSTYLE WS_EX_CONTROLPARENT +CAPTION "Join Tlen Multi-User Conference Room" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + LTEXT "Room:",IDC_ROOM_LABEL,10,13,43,8 + EDITTEXT IDC_ROOM,54,12,119,12,ES_AUTOHSCROLL + LTEXT "Nickname:",IDC_NICK_LABEL,10,30,40,8 + EDITTEXT IDC_NICK,54,29,119,12,ES_AUTOHSCROLL + DEFPUSHBUTTON "&Join",IDOK,75,59,50,14 + PUSHBUTTON "Cancel",IDCANCEL,129,59,50,14 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,50,172,4 +END + +IDD_HELPER_INVITE DIALOG DISCARDABLE 0, 0, 186, 79 +STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP | + WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Invite a User" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "User:",IDC_STATIC,10,13,43,8 + COMBOBOX IDC_USER,54,10,119,120,CBS_DROPDOWN | CBS_AUTOHSCROLL | + CBS_SORT | WS_VSCROLL | WS_TABSTOP + LTEXT "Reason:",IDC_STATIC,10,30,40,8 + EDITTEXT IDC_REASON,54,29,119,12,ES_AUTOHSCROLL + DEFPUSHBUTTON "&Invite",IDC_INVITE,75,59,50,14 + PUSHBUTTON "Cancel",IDCANCEL,129,59,50,14 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,50,172,4 +END + +IDD_HELPER_INVITE_ACCEPT DIALOG DISCARDABLE 0, 0, 232, 112 +STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP | + WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Multi-User Conference Invitation" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "&Accept",IDC_ACCEPT,124,93,50,14 + PUSHBUTTON "Cancel",IDCANCEL,178,93,50,14 + LTEXT "From:",IDC_STATIC,33,24,63,8 + LTEXT "Room:",IDC_STATIC,33,38,63,8 + LTEXT "Reason:",IDC_STATIC,33,52,63,8 + LTEXT "Nickname:",IDC_STATIC,33,76,62,8 + LTEXT "The following invitation to join a multi-user conference is received.", + IDC_STATIC,3,4,225,8 + EDITTEXT IDC_FROM,99,22,105,12,ES_AUTOHSCROLL | ES_READONLY + EDITTEXT IDC_ROOM,99,36,105,12,ES_AUTOHSCROLL | ES_READONLY + EDITTEXT IDC_REASON,99,50,105,12,ES_AUTOHSCROLL | ES_READONLY + EDITTEXT IDC_NICK,99,74,105,12,ES_AUTOHSCROLL + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,3,65,225,4 +END + +IDD_HELPER_TOPIC DIALOGEX 0, 0, 223, 44 +STYLE DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | + WS_VISIBLE | WS_CAPTION +EXSTYLE WS_EX_CONTROLPARENT +CAPTION "Change Chat Room Topic" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + LTEXT "New topic:",IDC_STATIC,10,8,43,8 + EDITTEXT IDC_TOPIC,54,7,160,12,ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",IDOK,108,26,50,14 + PUSHBUTTON "Cancel",IDCANCEL,164,26,50,14 +END + +IDD_USER_ADMIN DIALOG DISCARDABLE 0, 0, 300, 180 +STYLE DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | + WS_VISIBLE | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_CONTROLPARENT +CAPTION "Chat Room Administration" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Tab1",IDC_TABS,"SysTabControl32",TCS_BUTTONS | + TCS_FIXEDWIDTH | 0x8,0,5,220,20 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,20,300,4 + PUSHBUTTON "Close",IDCANCEL,230,162,60,16 + +END + +IDD_USER_KICK DIALOGEX 0, 30, 300, 130 +STYLE WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + LTEXT "Nickname:",IDC_STATIC,30,6,70,10 + EDITTEXT IDC_NICK,100,6,100,12,ES_AUTOHSCROLL | WS_TABSTOP + LTEXT "Ban for:",IDC_STATIC,30,35,70,10 + COMBOBOX IDC_KICK_OPTIONS,100,35,90,150,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + LTEXT "Reason:",IDC_STATIC,30,51,70,10 + EDITTEXT IDC_REASON,100,51,100,12,ES_AUTOHSCROLL | WS_TABSTOP + CONTROL "Kick && Ban",IDOK,"MButtonClass",WS_TABSTOP,210,65,60,16 + + LTEXT "User role:",IDC_STATIC,30,90,70,10 + COMBOBOX IDC_ROLE_OPTIONS,100,90,90,60,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + CONTROL "Set Role",IDC_SET_ROLE,"MButtonClass",WS_TABSTOP,210,104,60,16 + + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,128,300,4 +END + +IDD_USER_ROLE DIALOGEX 0, 30, 300, 130 +STYLE WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + LTEXT "Nickname:",IDC_STATIC,30,25,70,10 + EDITTEXT IDC_NICK,100,25,100,12,ES_AUTOHSCROLL | WS_TABSTOP + LTEXT "User role:",IDC_STATIC,30,41,70,10 + COMBOBOX IDC_OPTIONS,100,41,90,60,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + CONTROL "Set Role",IDOK,"MButtonClass",WS_TABSTOP,120,90,60,16 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,128,300,4 +END + +IDD_USER_BROWSER DIALOGEX 0, 30, 300, 130 +STYLE WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + COMBOBOX IDC_OPTIONS,50,0,90,60,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + CONTROL "Show",IDC_SHOW,"MButtonClass",WS_TABSTOP,160,0,50,14 + CONTROL "List1",IDC_LIST,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | + LVS_OWNERDRAWFIXED | WS_TABSTOP,0,20,299,110, + WS_EX_CLIENTEDGE +END + +IDD_OPT_POPUPS DIALOG DISCARDABLE 0, 0, 317, 141 +STYLE WS_CHILD +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Delay",IDC_STATIC,160,46,137,55 + CONTROL "&From PopUp plugin",IDC_DELAY_POPUP,"Button", + BS_AUTORADIOBUTTON,167,60,125,10 + CONTROL "&Custom",IDC_DELAY_CUSTOM,"Button",BS_AUTORADIOBUTTON, + 167,73,98,10 + CONTROL "P&ermanent",IDC_DELAY_PERMANENT,"Button", + BS_AUTORADIOBUTTON,167,87,123,10 + EDITTEXT IDC_DELAY,270,71,21,14,ES_AUTOHSCROLL | ES_NUMBER + GROUPBOX "Colours",IDC_STATIC,15,46,137,55 + LTEXT "Background",IDC_STATIC,53,63,95,8 + LTEXT "Text",IDC_STATIC,53,82,96,8 + CONTROL "",IDC_COLORBKG,"ColourPicker",WS_TABSTOP,23,61,24,12 + GROUPBOX "General Options",IDC_STATIC,15,15,282,26 + CONTROL "",IDC_COLORTXT,"ColourPicker",WS_TABSTOP,23,79,24,12 + PUSHBUTTON "Preview",IDC_PREVIEW,132,112,50,14 + CONTROL "Enable incoming mail notification",IDC_ENABLEPOPUP, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,26,130,10 +END + +IDD_TAB_CHATROOMS DIALOGEX 216, 28, 247, 180 +STYLE WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "List1",IDC_ROOM,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | + LVS_OWNERDRAWFIXED | WS_TABSTOP,0,26,247,154, + WS_EX_CLIENTEDGE + CONTROL "prev",IDC_PREV,"MButtonClass",WS_TABSTOP,5,6,20,16 + CONTROL "next",IDC_NEXT,"MButtonClass",WS_TABSTOP,35,6,20,16 + CONTROL "find",IDC_SEARCH,"MButtonClass",WS_TABSTOP,65,6,20,16 +END + +IDD_TAB_MYROOMS DIALOGEX 216, 28, 244, 180 +STYLE WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Create",IDC_REGISTER,"MButtonClass",WS_TABSTOP,186,62, + 50,14,0x18000000L + EDITTEXT IDC_NAME,84,20,149,14,ES_AUTOHSCROLL + LTEXT "Room name:",IDC_STATIC,14,23,60,8 + CONTROL "Permanent",IDC_CHECK_PERMANENT,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,111,40,89,10 + CONTROL "Nicknames",IDC_CHECK_NICKNAMES,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,13,52,89,10 + CONTROL "Public",IDC_CHECK_PUBLIC,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,13,40,89,10 + CONTROL "Members only",IDC_CHECK_MEMBERS,"Button", + BS_AUTOCHECKBOX,111,52,89,10 + LTEXT "Chat rooms:",IDC_STATIC,2,90,100,8 + /* + CONTROL "Tree1",IDC_LIST,"SysTreeView32",TVS_DISABLEDRAGDROP | + TVS_SHOWSELALWAYS | TVS_NOTOOLTIPS | TVS_FULLROWSELECT | + TVS_NONEVENHEIGHT,0,100,177,80,WS_EX_STATICEDGE + */ + CONTROL "Refresh",IDC_REFRESH,"MButtonClass",WS_TABSTOP,186,160, + 50,14,0x18000000L + GROUPBOX "New chat room",IDC_STATIC,0,5,244,78 + CONTROL "List1",IDC_LIST,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | + LVS_NOCOLUMNHEADER | LVS_OWNERDRAWFIXED | WS_TABSTOP,0,100,177,80, + WS_EX_CLIENTEDGE +END + +IDD_TAB_MYNICKNAMES DIALOG DISCARDABLE 216, 28, 244, 180 +STYLE WS_CHILD +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Register",IDC_REGISTER,"MButtonClass",WS_TABSTOP,186,62, + 50,14,0x18000000L + EDITTEXT IDC_NICK,84,20,149,14,ES_AUTOHSCROLL + LTEXT "Nickname:",IDC_STATIC,14,23,60,8 + LTEXT "Nicknames:",IDC_STATIC,2,90,100,8 + CONTROL "Remove",IDC_REMOVE,"MButtonClass",WS_TABSTOP,186,110,50, + 14,0x18000000L + CONTROL "Refresh",IDC_REFRESH,"MButtonClass",WS_TABSTOP,186,160, + 50,14,0x18000000L + GROUPBOX "New nickname",IDC_STATIC,0,5,244,78 + CONTROL "List1",IDC_LIST,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | + LVS_NOCOLUMNHEADER | LVS_OWNERDRAWFIXED | WS_TABSTOP,0,100,177,80, + WS_EX_CLIENTEDGE + /* + CONTROL "Tree1",IDC_LIST,"SysTreeView32",TVS_DISABLEDRAGDROP | + TVS_SHOWSELALWAYS | TVS_NOTOOLTIPS | TVS_FULLROWSELECT | + TVS_NONEVENHEIGHT,0,100,177,80,WS_EX_STATICEDGE + */ +END + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION MUCC_FILEVERSION_STRING + PRODUCTVERSION MUCC_FILEVERSION_STRING + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "041504e3" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "http://mtlen.berlios.de\0" + VALUE "FileDescription", "Group Chats GUI Plugin for Miranda IM\0" + VALUE "FileVersion", MUCC_VERSION_STRING + VALUE "InternalName", "tlen_chat\0" + VALUE "LegalCopyright", "Copyright (c) 2004-2006 Piotr Piastucki\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "tlen_chat.dll\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Tlen Chat Plugin\0" + VALUE "ProductVersion", MUCC_VERSION_STRING + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x415, 1251 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_CHAT ICON DISCARDABLE "icos\\chat.ico" +IDI_BLANK ICON DISCARDABLE "icos\\blank.ico" +IDI_ITALIC ICON DISCARDABLE "icos\\italic.ico" +IDI_BOLD ICON DISCARDABLE "icos\\bold.ico" +IDI_UNDERLINE ICON DISCARDABLE "icos\\underline.ico" +IDI_OPTIONS ICON DISCARDABLE "icos\\options.ico" +IDI_OWNER ICON DISCARDABLE "icos\\owner.ico" +IDI_GLOBALOWNER ICON DISCARDABLE "icos\\glowner.ico" +IDI_ADMIN ICON DISCARDABLE "icos\\admin.ico" +IDI_REGISTERED ICON DISCARDABLE "icos\\registered.ico" +IDI_R_MODERATED ICON DISCARDABLE "icos\\r_mod.ico" +IDI_R_MEMBERS ICON DISCARDABLE "icos\\r_memb.ico" +IDI_R_ANONYMOUS ICON DISCARDABLE "icos\\r_anon.ico" +IDI_SEARCH ICON DISCARDABLE "icos\\search.ico" +IDI_PREV ICON DISCARDABLE "icos\\prev.ico" +IDI_NEXT ICON DISCARDABLE "icos\\next.ico" +IDI_INVITE ICON DISCARDABLE "icos\\invite.ico" +IDI_ADMINISTRATION ICON DISCARDABLE "icos\\administration.ico" +IDI_SMILEY ICON DISCARDABLE "icos\\smile.ico" +IDI_MESSAGE ICON DISCARDABLE "icos\\message.ico" +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/!NotAdopted/Tlen/tlen_czaty/mucc.vcxproj b/!NotAdopted/Tlen/tlen_czaty/mucc.vcxproj new file mode 100644 index 0000000000..c2fe6e7b70 --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/mucc.vcxproj @@ -0,0 +1,1245 @@ + + + + + Debug Ansi + Win32 + + + Debug Ansi + x64 + + + Debug Unicode + Win32 + + + Debug Unicode + x64 + + + Debug x64 + Win32 + + + Debug x64 + x64 + + + Release Ansi + Win32 + + + Release Ansi + x64 + + + Release Unicode + Win32 + + + Release Unicode + x64 + + + Release x64 + Win32 + + + Release x64 + x64 + + + + {BD1D155A-7A47-4414-80A3-CCCC3C5C583B} + + + + DynamicLibrary + false + Unicode + Windows7.1SDK + + + DynamicLibrary + false + Unicode + Windows7.1SDK + + + DynamicLibrary + false + Unicode + Windows7.1SDK + + + DynamicLibrary + false + Unicode + Windows7.1SDK + + + DynamicLibrary + false + MultiByte + Windows7.1SDK + + + DynamicLibrary + false + MultiByte + Windows7.1SDK + + + DynamicLibrary + false + Unicode + Windows7.1SDK + true + + + DynamicLibrary + false + Unicode + Windows7.1SDK + true + + + DynamicLibrary + false + Unicode + Windows7.1SDK + true + + + DynamicLibrary + false + Unicode + Windows7.1SDK + true + + + DynamicLibrary + false + MultiByte + Windows7.1SDK + true + + + DynamicLibrary + false + MultiByte + Windows7.1SDK + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(Configuration)\ + $(Configuration)\ + $(Configuration)\ + $(Configuration)\ + $(Configuration)\ + $(Configuration)\ + $(Configuration)\Obj\ + $(Configuration)\Obj\ + $(Configuration)\Obj\ + $(Configuration)\Obj\ + $(Configuration)\Obj\ + $(Configuration)\Obj\ + true + true + true + true + true + true + false + false + false + false + false + false + $(Configuration)\ + $(Configuration)\ + $(Configuration)\ + $(Configuration)\ + $(Configuration)\ + $(Configuration)\ + $(Configuration)\Obj\ + $(Configuration)\Obj\ + $(Configuration)\Obj\ + $(Configuration)\Obj\ + $(Configuration)\Obj\ + $(Configuration)\Obj\ + true + true + true + true + true + true + true + true + true + true + true + true + tlen_czaty + tlen_czaty + tlen_czaty + tlen_czaty + tlen_czaty + tlen_czaty + tlen_czaty + tlen_czaty + tlen_czaty + tlen_czaty + tlen_czaty + tlen_czaty + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Release/mucc.tlb + + + + + MaxSpeed + OnlyExplicitInline + ../../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;_X64;X64;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + $(IntDir)$(TargetName).pch + + + $(IntDir) + $(IntDir)vc$(PlatformToolsetVersion).pdb + Level3 + true + 4996;%(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0415 + + + odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName)$(TargetExt) + true + $(TargetDir)tlen_czaty.pdb + 0x32600000 + false + + + $(IntDir)$(TargetName).lib + MachineX86 + true + + + true + $(OutDir)$(TargetName).bsc + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + .\Release/mucc.tlb + + + + + MaxSpeed + OnlyExplicitInline + ../../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;UNICODE;_UNICODE;_X64;X64;%(PreprocessorDefinitions) + true + MultiThreaded + true + $(IntDir)$(TargetName).pch + + + $(IntDir) + $(IntDir)vc$(PlatformToolsetVersion).pdb + Level3 + true + 4996;%(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0415 + + + odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName)$(TargetExt) + true + $(TargetDir)tlen_czaty.pdb + 0x32600000 + false + + + $(IntDir)$(TargetName).lib + true + + + true + $(OutDir)$(TargetName).bsc + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Release/mucc.tlb + + + + + MaxSpeed + OnlyExplicitInline + ../../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreaded + true + $(IntDir)$(TargetName).pch + + + $(IntDir) + $(IntDir)vc$(PlatformToolsetVersion).pdb + Level3 + true + 4996;%(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0415 + + + odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName)$(TargetExt) + true + $(TargetDir)tlen_czaty.pdb + 0x32600000 + false + + + $(IntDir)$(TargetName).lib + MachineX86 + true + + + true + $(OutDir)$(TargetName).bsc + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + .\Release/mucc.tlb + + + + + MaxSpeed + OnlyExplicitInline + ../../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;UNICODE;_UNICODE;%(PreprocessorDefinitions) + true + MultiThreaded + true + $(IntDir)$(TargetName).pch + + + $(IntDir) + $(IntDir)vc$(PlatformToolsetVersion).pdb + Level3 + true + 4996;%(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0415 + + + odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName)$(TargetExt) + true + $(TargetDir)tlen_czaty.pdb + 0x32600000 + false + + + $(IntDir)$(TargetName).lib + true + + + true + $(OutDir)$(TargetName).bsc + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Release/mucc.tlb + + + + + MaxSpeed + OnlyExplicitInline + ../../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreaded + true + $(IntDir)$(TargetName).pch + + + $(IntDir) + $(IntDir)vc$(PlatformToolsetVersion).pdb + Level3 + true + ProgramDatabase + 4996;%(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0415 + + + odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName)$(TargetExt) + true + $(TargetDir)tlen_czaty.pdb + 0x32600000 + false + + + $(IntDir)$(TargetName).lib + MachineX86 + true + + + true + $(OutDir)$(TargetName).bsc + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + .\Release/mucc.tlb + + + + + MaxSpeed + OnlyExplicitInline + ../../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreaded + true + $(IntDir)$(TargetName).pch + + + $(IntDir) + $(IntDir)vc$(PlatformToolsetVersion).pdb + Level3 + true + ProgramDatabase + 4996;%(DisableSpecificWarnings) + + + NDEBUG;%(PreprocessorDefinitions) + 0x0415 + + + odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName)$(TargetExt) + true + $(TargetDir)tlen_czaty.pdb + 0x32600000 + false + + + $(IntDir)$(TargetName).lib + true + + + true + $(OutDir)$(TargetName).bsc + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Debug/mucc.tlb + + + + + Disabled + ../../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;X64;_X64;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + $(IntDir)$(TargetName).pch + + + $(IntDir) + $(IntDir)vc$(PlatformToolsetVersion).pdb + Level3 + true + EditAndContinue + 4996;%(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0415 + + + odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName)$(TargetExt) + true + true + $(TargetDir)tlen_czaty.pdb + false + + + $(IntDir)$(TargetName).lib + MachineX86 + + + true + $(OutDir)$(TargetName).bsc + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + .\Debug/mucc.tlb + + + + + Disabled + ../../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;UNICODE;_UNICODE;X64;_X64;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + $(IntDir)$(TargetName).pch + + + $(IntDir) + $(IntDir)vc$(PlatformToolsetVersion).pdb + Level3 + true + ProgramDatabase + 4996;%(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0415 + + + odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName)$(TargetExt) + true + true + $(TargetDir)tlen_czaty.pdb + false + + + $(IntDir)$(TargetName).lib + + + true + $(OutDir)$(TargetName).bsc + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Debug/mucc.tlb + + + + + Disabled + ../../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + $(IntDir)$(TargetName).pch + + + $(IntDir) + $(IntDir)vc$(PlatformToolsetVersion).pdb + Level3 + true + EditAndContinue + 4996;%(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0415 + + + odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName)$(TargetExt) + true + true + $(TargetDir)tlen_czaty.pdb + false + + + $(IntDir)$(TargetName).lib + MachineX86 + + + true + $(OutDir)$(TargetName).bsc + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + .\Debug/mucc.tlb + + + + + Disabled + ../../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;UNICODE;_UNICODE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + $(IntDir)$(TargetName).pch + + + $(IntDir) + $(IntDir)vc$(PlatformToolsetVersion).pdb + Level3 + true + ProgramDatabase + 4996;%(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0415 + + + odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName)$(TargetExt) + true + true + $(TargetDir)tlen_czaty.pdb + false + + + $(IntDir)$(TargetName).lib + + + true + $(OutDir)$(TargetName).bsc + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Debug/mucc.tlb + + + + + Disabled + ../../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + $(IntDir)$(TargetName).pch + + + $(IntDir) + $(IntDir)vc$(PlatformToolsetVersion).pdb + Level3 + true + EditAndContinue + 4996;%(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0415 + + + odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName)$(TargetExt) + true + true + $(TargetDir)tlen_czaty.pdb + false + + + $(IntDir)$(TargetName).lib + MachineX86 + + + true + $(OutDir)$(TargetName).bsc + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + .\Debug/mucc.tlb + + + + + Disabled + ../../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;MUCC_EXPORTS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + $(IntDir)$(TargetName).pch + + + $(IntDir) + $(IntDir)vc$(PlatformToolsetVersion).pdb + Level3 + true + ProgramDatabase + 4996;%(DisableSpecificWarnings) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0415 + + + odbc32.lib;odbccp32.lib;comctl32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName)$(TargetExt) + true + true + $(TargetDir)tlen_czaty.pdb + false + + + $(IntDir)$(TargetName).lib + + + true + $(OutDir)$(TargetName).bsc + + + + + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + + + + \ No newline at end of file diff --git a/!NotAdopted/Tlen/tlen_czaty/mucc_services.cpp b/!NotAdopted/Tlen/tlen_czaty/mucc_services.cpp new file mode 100644 index 0000000000..0d4571a633 --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/mucc_services.cpp @@ -0,0 +1,140 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +#include "mucc_services.h" +#include "Utils.h" +#include "HelperDialog.h" + +int MUCCQueryChatGroups(MUCCQUERYRESULT *queryResult) +{ + ManagerWindow *managerWnd=ManagerWindow::getWindow(queryResult->pszModule); + if (managerWnd!=NULL) { + managerWnd->queryResultGroups(queryResult); + } + return 1; +} + +int MUCCQueryChatRooms(MUCCQUERYRESULT *queryResult) +{ + ManagerWindow *managerWnd=ManagerWindow::getWindow(queryResult->pszModule); + if (managerWnd!=NULL) { + managerWnd->queryResultRooms(queryResult); + } + return 1; +} + +int MUCCQueryUserRooms(MUCCQUERYRESULT *queryResult) +{ + ManagerWindow *managerWnd=ManagerWindow::getWindow(queryResult->pszModule); + if (managerWnd!=NULL) { + managerWnd->queryResultUserRooms(queryResult); + } + return 1; +} + +int MUCCQueryUserNicks(MUCCQUERYRESULT *queryResult) +{ + ManagerWindow *managerWnd=ManagerWindow::getWindow(queryResult->pszModule); + if (managerWnd!=NULL) { + managerWnd->queryResultUserNick(queryResult); + } + return 1; +} + +INT_PTR MUCCQueryResult(WPARAM wParam, LPARAM lParam) +{ + MUCCQUERYRESULT *queryResult=(MUCCQUERYRESULT *)lParam; + ChatWindow * chatWindow = NULL; + switch (queryResult->iType) { + case MUCC_EVENT_QUERY_GROUPS: + MUCCQueryChatGroups(queryResult); + break; + case MUCC_EVENT_QUERY_ROOMS: + MUCCQueryChatRooms(queryResult); + break; + case MUCC_EVENT_QUERY_USER_ROOMS: + MUCCQueryUserRooms(queryResult); + break; + case MUCC_EVENT_QUERY_USER_NICKS: + MUCCQueryUserNicks(queryResult); + break; + case MUCC_EVENT_QUERY_CONTACTS: + case MUCC_EVENT_QUERY_USERS: + chatWindow=ChatWindow::getWindow(queryResult->pszModule, queryResult->pszParent); + if (chatWindow!=NULL) { + SendMessage(chatWindow->getHWND(), DM_CHAT_QUERY, (WPARAM) 0, (LPARAM) queryResult); + } + break; + } + return 0; +} + +INT_PTR MUCCNewWindow(WPARAM wParam, LPARAM lParam) +{ + MUCCWINDOW *mucWindow = (MUCCWINDOW *) lParam; + if (mucWindow->iType == MUCC_WINDOW_CHATROOM) { + ChatWindow *chat = ChatWindow::getWindow(mucWindow->pszModule, mucWindow->pszID); + if (chat == NULL) { + chat = new ChatWindow(mucWindow); + } + } else if (mucWindow->iType == MUCC_WINDOW_CHATLIST) { + ManagerWindow *manager = ManagerWindow::getWindow(mucWindow->pszModule); + if (manager == NULL) { + + } + //Utils::log("setting name: %s", mucWindow->pszModuleName); + manager->setModuleName(mucWindow->pszModuleName); + manager->start(); + } + return 0; +} + +INT_PTR MUCCEvent(WPARAM wParam, LPARAM lParam) +{ + MUCCEVENT* mucEvent = (MUCCEVENT *) lParam; + ChatWindow * chatWindow = NULL; + switch (mucEvent->iType) { + case MUCC_EVENT_STATUS: + case MUCC_EVENT_MESSAGE: + case MUCC_EVENT_ROOM_INFO: + case MUCC_EVENT_LEAVE: + case MUCC_EVENT_TOPIC: + chatWindow = ChatWindow::getWindow(mucEvent->pszModule, mucEvent->pszID); + if (chatWindow!=NULL) { + SendMessage(chatWindow->getHWND(), DM_CHAT_EVENT, (WPARAM) 0, (LPARAM) mucEvent); + } + break; + case MUCC_EVENT_ERROR: + chatWindow = ChatWindow::getWindow(mucEvent->pszModule, mucEvent->pszID); + if (chatWindow!=NULL) { + SendMessage(chatWindow->getHWND(), DM_CHAT_EVENT, (WPARAM) 0, (LPARAM) mucEvent); + } else { + HelperDialog::errorDlg(mucEvent); + } + break; + case MUCC_EVENT_INVITATION: + HelperDialog::acceptDlg(mucEvent); + break; + case MUCC_EVENT_JOIN: + HelperDialog::joinDlg(mucEvent); + break; + } + return 0; +} diff --git a/!NotAdopted/Tlen/tlen_czaty/mucc_services.h b/!NotAdopted/Tlen/tlen_czaty/mucc_services.h new file mode 100644 index 0000000000..f1db38274b --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/mucc_services.h @@ -0,0 +1,35 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +#ifndef MUCCSERVICES_INCLUDED +#define MUCCSERVICES_INCLUDED + +#include "mucc.h" +#include "ManagerWindow.h" +#include "ChatWindow.h" + +extern int MUCCServicesInit(WPARAM wParam, LPARAM lParam); + +extern INT_PTR MUCCQueryResult(WPARAM wParam, LPARAM lParam) ; +extern INT_PTR MUCCNewWindow(WPARAM wParam, LPARAM lParam) ; +extern INT_PTR MUCCEvent(WPARAM wParam, LPARAM lParam) ; + +#endif + diff --git a/!NotAdopted/Tlen/tlen_czaty/resource.h b/!NotAdopted/Tlen/tlen_czaty/resource.h new file mode 100644 index 0000000000..c4d2f1945c --- /dev/null +++ b/!NotAdopted/Tlen/tlen_czaty/resource.h @@ -0,0 +1,218 @@ +/* + +MUCC Group Chat GUI Plugin for Miranda IM +Copyright (C) 2004 Piotr Piastucki + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +#define IDI_CHAT 100 +#define IDI_ITALIC 101 +#define IDI_BOLD 102 +#define IDI_UNDERLINE 103 +#define IDI_OPTIONS 104 +#define IDI_OWNER 105 +#define IDI_ADMIN 106 +#define IDI_REGISTERED 107 +#define IDI_R_MODERATED 108 +#define IDI_R_MEMBERS 109 +#define IDI_R_ANONYMOUS 110 +#define IDI_SEARCH 111 +#define IDI_PREV 112 +#define IDI_NEXT 113 +#define IDI_BLANK 114 +#define IDI_INVITE 115 +#define IDI_ADMINISTRATION 116 +#define IDI_GLOBALOWNER 117 +#define IDI_SMILEY 118 +#define IDI_MESSAGE 119 + +#define IDD_CHATMANAGER 150 +#define IDD_GROUPCHAT_LOG 151 +#define IDD_HELPER_JOIN 152 +#define IDD_HELPER_INPUT 153 +#define IDD_HELPER_INVITE 154 +#define IDD_HELPER_INVITE_ACCEPT 155 +#define IDD_HELPER_TOPIC 156 +#define IDD_OPTIONS 157 +#define IDD_OPT_POPUPS 158 +#define IDD_TAB_CHATROOMS 159 +#define IDD_TAB_MYROOMS 160 +#define IDD_TAB_MYNICKNAMES 161 +#define IDD_USER_ADMIN 162 +#define IDD_USER_KICK 163 +#define IDD_USER_ROLE 164 +#define IDD_USER_BROWSER 165 +#define IDD_GROUPCHAT_CONTAINER 166 + +#define IDR_CHATOPTIONS 200 +#define IDR_CONTEXT 201 + +#define IDC_FONTLIST 1000 +#define IDC_COLORINPUT 1001 +#define IDC_COLORBKG 1002 +#define IDC_COLORLIST 1003 +#define IDC_COLORTXT 1004 +#define IDC_CHOOSEFONT 1005 +#define IDC_FONTSGB 1006 +#define IDC_OPTIONSGB 1007 +#define IDC_LOGLIMITSPIN 1008 +#define IDC_LOGLIMIT 1009 +#define IDC_SENDONENTER 1010 +#define IDC_USETABS 1011 +#define IDC_ENABLEIEVIEW 1012 +#define IDC_REGISTER 1020 +#define IDC_NAME 1021 +#define IDC_FRAME 1037 +#define IDC_SIMPLE 1041 +#define IDC_PASSWORD 1050 +#define IDC_JID 1051 +#define IDC_COUNTRY 1060 +#define IDC_NICKNAME 1062 +#define IDC_MSG 1084 +#define IDC_TITLE 1089 +#define IDC_DESC 1090 +#define IDC_DELETE 1092 +#define IDC_LOAD 1093 +#define IDC_JOIN 1123 +#define IDC_ROOM 1124 +#define IDC_ROOM_LABEL 1125 +#define IDC_BROWSE 1126 +#define IDC_VSCROLL 1128 +#define IDC_NICK 1129 +#define IDC_NICK_LABEL 1130 +#define IDC_EDIT 1131 +#define IDC_TREELIST 1132 +#define IDC_LIST 1133 +#define IDC_HSPLIT 1134 +#define IDC_LOG 1136 +#define IDC_VSPLIT 1137 +#define IDC_SET 1140 +#define IDC_TABS 1141 +#define IDC_TOPIC 1141 +#define IDC_TOPIC_BUTTON 1142 +#define IDC_FONT 1143 +#define IDC_ENTER 1144 +#define IDC_CTRLENTER 1145 +#define IDC_FLASH 1148 +#define IDC_TIME 1156 +#define IDC_DATE 1157 +#define IDC_REASON 1171 +#define IDC_USER 1172 +#define IDC_INVITE 1173 +#define IDC_ACCEPT 1174 +#define IDC_FROM 1175 +#define IDC_DELAY 1180 +#define IDC_PREVIEW 1183 +#define IDC_ENABLEPOPUP 1184 +#define IDC_DELAY_PERMANENT 1185 +#define IDC_DELAY_CUSTOM 1186 +#define IDC_DELAY_POPUP 1187 +#define IDC_GROUP 1203 +#define IDC_BOLD 1204 +#define IDC_SMILEY 1205 +#define IDC_UNDERLINE 1205 +#define IDC_ITALIC 1206 +#define IDC_COLOR 1207 +#define IDC_OPTIONS 1208 +#define IDC_SMILEYBTN 1209 +#define IDC_CHECK_PERMANENT 1210 +#define IDC_CHECK_PUBLIC 1211 +#define IDC_CHECK_NICKNAMES 1212 +#define IDC_CHECK_MEMBERS 1213 +#define IDC_NEXT 1214 +#define IDC_PREV 1215 +#define IDC_FONTSIZE 1215 +#define IDC_SEARCH 1216 +#define IDC_REFRESH 1216 +#define IDC_REMOVE 1217 +#define IDC_KICK_OPTIONS 1218 +#define IDC_ROLE_OPTIONS 1219 +#define IDC_KICK 1220 +#define IDC_SET_ROLE 1221 +#define IDC_UPDATE 1313 +#define IDC_STATUS 1414 +#define IDC_PLAN 1415 +#define IDC_SHOW 1416 + +#define IDC_PERSONALGROUP 1434 +#define IDC_EXTRAGROUP 1436 + +#define ID_OPTIONMENU_SHOWNICKNAMES 40001 +#define ID_OPTIONMENU_MSGINNEWLINE 40002 +#define ID_OPTIONMENU_SHOWTIMESTAMP 40011 +#define ID_OPTIONMENU_SHOWDATE 40012 +#define ID_OPTIONMENU_SHOWSECONDS 40013 +#define ID_OPTIONMENU_USELONGDATE 40014 +#define ID_OPTIONMENU_FORMATFONT 40021 +#define ID_OPTIONMENU_FORMATSIZE 40022 +#define ID_OPTIONMENU_FORMATCOLOR 40023 +#define ID_OPTIONMENU_FORMATSTYLE 40024 +#define ID_OPTIONMENU_LOGMESSAGES 40031 +#define ID_OPTIONMENU_LOGJOINED 40032 +#define ID_OPTIONMENU_LOGLEFT 40033 +#define ID_OPTIONMENU_LOGTOPIC 40034 +#define ID_OPTIONMENU_FLASHMESSAGES 40035 +#define ID_OPTIONMENU_FLASHJOINED 40036 +#define ID_OPTIONMENU_FLASHLEFT 40037 +#define ID_OPTIONMENU_FLASHTOPIC 40038 +#define ID_OPTIONMENU_SAVEDEFAULT 40040 +#define ID_USERMENU_MESSAGE 40050 +#define ID_USERMENU_KICK_POPUP 40051 +#define ID_USERMENU_KICK_NO_BAN 40052 +#define ID_USERMENU_KICK_BAN_1_MIN 40053 +#define ID_USERMENU_KICK_BAN_5_MIN 40054 +#define ID_USERMENU_KICK_BAN_15_MIN 40055 +#define ID_USERMENU_KICK_BAN_30_MIN 40056 +#define ID_USERMENU_KICK_BAN_1_H 40057 +#define ID_USERMENU_KICK_BAN_6_H 40058 +#define ID_USERMENU_KICK_BAN_1_D 40059 +#define ID_USERMENU_KICK_BAN_3_D 40060 +#define ID_USERMENU_KICK_BAN_1_W 40061 +#define ID_USERMENU_KICK_BAN_2_W 40062 +#define ID_USERMENU_KICK_BAN_4_W 40063 +#define ID_USERMENU_RIGHTS_NO 40065 +#define ID_USERMENU_RIGHTS_MEMBER 40066 +#define ID_USERMENU_RIGHTS_ADMIN 40067 +#define ID_USERMENU_ADMINISTRATION 40070 +#define ID_USERMENU_UNBAN 40071 +#define ID_ADMINMENU_DESTROY 40080 +#define ID_ADMINMENU_ADMIN 40081 +#define ID_ADMINMENU_BROWSE 40082 +#define ID_ADMINMENU_SAVELOG 40083 + +#define IDM_CUT 40000 +#define IDM_COPY 40001 +#define IDM_PASTE 40002 +#define IDM_UNDO 40003 +#define IDM_DELETE 40004 +#define IDM_REDO 40005 +#define IDM_COPYALL 40011 +#define IDM_SELECTALL 40012 +#define IDM_CLEAR 40013 +#define IDM_OPENNEW 40014 +#define IDM_OPENEXISTING 40015 +#define IDM_COPYLINK 40016 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 205 +#define _APS_NEXT_COMMAND_VALUE 40090 +#define _APS_NEXT_CONTROL_VALUE 1217 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif -- cgit v1.2.3