| 1 |
/*
|
| 2 |
* Copyright (C) 2001 Erik Latoshek [forester] (laterk@inbox.lv)
|
| 3 |
*
|
| 4 |
* This program is free software; you can redistribute it and/or
|
| 5 |
* modify it under the terms of the GNU General Public License
|
| 6 |
* as published by the Free Software Foundation; either version 2
|
| 7 |
* of the License, or (at your option) any later version.
|
| 8 |
*
|
| 9 |
* This program is distributed in the hope that it will be useful,
|
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
* GNU General Public License for more details.
|
| 13 |
*
|
| 14 |
* You should have received a copy of the GNU General Public License
|
| 15 |
* along with this program; if not, write to the Free Software
|
| 16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
| 17 |
*/
|
| 18 |
|
| 19 |
#ifdef WIN32_GUI
|
| 20 |
|
| 21 |
#pragma warning(disable : 4047)
|
| 22 |
|
| 23 |
#include "common/setup_before.h"
|
| 24 |
#include "winmain.h"
|
| 25 |
#include <time.h>
|
| 26 |
#include "common/eventlog.h"
|
| 27 |
#include "common/version.h"
|
| 28 |
#include "common/list.h"
|
| 29 |
#include "bnetd/server.h"
|
| 30 |
#include "bnetd/connection.h" //by greini needed for the user or connectionlist
|
| 31 |
#include "bnetd/account_wrap.h"
|
| 32 |
#include "bnetd/account.h"
|
| 33 |
#include <string.h>
|
| 34 |
#include <windows.h>
|
| 35 |
#include <winuser.h> //amadeo
|
| 36 |
#include <windowsx.h>
|
| 37 |
#include <process.h>
|
| 38 |
#include <stdio.h>
|
| 39 |
#include <richedit.h>
|
| 40 |
#include <commctrl.h>
|
| 41 |
#include "bnetd/message.h" //amadeo
|
| 42 |
#include "win32/resource.h"
|
| 43 |
#include "bnetd/ipban.h" //zak
|
| 44 |
|
| 45 |
#include "common/addr.h" //added for borland, should not be a prob for VS.NET
|
| 46 |
#include "common/setup_after.h"
|
| 47 |
|
| 48 |
#define WM_SHELLNOTIFY (WM_USER+1)
|
| 49 |
|
| 50 |
int extern server_main(int, char*[]);
|
| 51 |
|
| 52 |
|
| 53 |
void static guiThread(void*);
|
| 54 |
void static guiAddText(const char *, COLORREF);
|
| 55 |
void static guiAddText_user(const char *, COLORREF);
|
| 56 |
void static guiDEAD(char*);
|
| 57 |
void static guiMoveWindow(HWND, RECT*);
|
| 58 |
void static guiClearLogWindow(void);
|
| 59 |
void static guiKillTrayIcon(void);
|
| 60 |
|
| 61 |
//by greini eventhandler return value changed
|
| 62 |
//LRESULT CALLBACK static guiWndProc(HWND, UINT, WPARAM, LPARAM);
|
| 63 |
long PASCAL guiWndProc(HWND, UINT, WPARAM, LPARAM);
|
| 64 |
void static guiOnCommand(HWND, int, HWND, UINT);
|
| 65 |
void static guiOnMenuSelect(HWND, HMENU, int, HMENU, UINT);
|
| 66 |
int static guiOnShellNotify(int, int);
|
| 67 |
BOOL static guiOnCreate(HWND, LPCREATESTRUCT);
|
| 68 |
void static guiOnClose(HWND);
|
| 69 |
void static guiOnSize(HWND, UINT, int, int);
|
| 70 |
void static guiOnPaint(HWND);
|
| 71 |
void static guiOnCaptureChanged(HWND);
|
| 72 |
BOOL static guiOnSetCursor(HWND, HWND, UINT, UINT);
|
| 73 |
void static guiOnMouseMove(HWND, int, int, UINT);
|
| 74 |
void static guiOnLButtonDown(HWND, BOOL, int, int, UINT);
|
| 75 |
void static guiOnLButtonUp(HWND, int, int, UINT);
|
| 76 |
void extern guiOnUpdateUserList(void); //amadeo
|
| 77 |
void static guiOnServerConfig (void); //amadeo
|
| 78 |
void static guiOnAbout (HWND); //amadeo
|
| 79 |
void static guiOnUpdates (void); //amadeo
|
| 80 |
void static guiOnAnnounce (HWND); //amadeo & honni
|
| 81 |
void static guiOnUserStatusChange (HWND); //amadeo
|
| 82 |
|
| 83 |
BOOL CALLBACK AboutDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); //amadeo
|
| 84 |
BOOL CALLBACK AnnDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); //amadeo& honni announcement box
|
| 85 |
BOOL CALLBACK KickDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); //amadeo
|
| 86 |
|
| 87 |
#define MODE_HDIVIDE 1
|
| 88 |
#define MODE_VDIVIDE 1
|
| 89 |
struct gui_struc{
|
| 90 |
HWND hwnd;
|
| 91 |
HMENU hmenuTray;
|
| 92 |
HWND hwndConsole;
|
| 93 |
HWND hwndUsers; //amadeo
|
| 94 |
HWND hwndUserCount; //amadeo
|
| 95 |
HWND hwndUserEditButton;
|
| 96 |
HWND hwndTree;
|
| 97 |
//HWND hwndStatus; //by greini CreateStatusWindow doesn't exist in winxp anymore, but it should work on winnt/98 etc.
|
| 98 |
int y_ratio;
|
| 99 |
int x_ratio;
|
| 100 |
HANDLE event_ready;
|
| 101 |
BOOL main_finished;
|
| 102 |
int mode;
|
| 103 |
char szDefaultStatus[128];
|
| 104 |
|
| 105 |
RECT rectHDivider,
|
| 106 |
rectVDivider,
|
| 107 |
rectConsole,
|
| 108 |
rectUsers,
|
| 109 |
rectConsoleEdge,
|
| 110 |
rectUsersEdge;
|
| 111 |
|
| 112 |
WPARAM wParam;
|
| 113 |
LPARAM lParam;
|
| 114 |
};
|
| 115 |
|
| 116 |
static struct gui_struc gui;
|
| 117 |
HWND hButton; //amadeo checkbox-querys for useredit
|
| 118 |
HWND hButton1;//amadeo checkbox-querys for useredit
|
| 119 |
HWND hButton2;//amadeo checkbox-querys for useredit
|
| 120 |
HWND hButton3;//amadeo checkbox-querys for useredit
|
| 121 |
HWND hButton4;//amadeo checkbox-querys for useredit
|
| 122 |
char selected_item[255]; //amadeo: userlist->kick-box
|
| 123 |
char name1[35]; //by amadeo (for userlist)
|
| 124 |
char UserCount[80]; //anadeo , neede for UserCount disp
|
| 125 |
t_connection * conngui; //amadeo needed for kick/ipban users
|
| 126 |
t_account * accountgui; //amadeo needed for setting admin/mod/ann
|
| 127 |
const char * gtrue="true"; //needed for setting authorizations
|
| 128 |
unsigned int i_GUI; //amadeo my favourite counter :-)
|
| 129 |
int len; //amadeo don't care :)
|
| 130 |
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE reserved,
|
| 131 |
LPSTR lpCmdLine, int nCmdShow){
|
| 132 |
int result;
|
| 133 |
gui.main_finished = FALSE;
|
| 134 |
gui.event_ready = CreateEvent(NULL, FALSE, FALSE, NULL);
|
| 135 |
_beginthread( guiThread, 0, (void*)hInstance);
|
| 136 |
WaitForSingleObject(gui.event_ready, INFINITE);
|
| 137 |
|
| 138 |
//by greini new call of main cause _argc and _argv don't exist in VS
|
| 139 |
//result = main(_argc, _argv);
|
| 140 |
result = server_main(__argc ,__argv);
|
| 141 |
|
| 142 |
gui.main_finished = TRUE;
|
| 143 |
eventlog(eventlog_level_debug,__FUNCTION__,"server exited ( return : %i )", result);
|
| 144 |
WaitForSingleObject(gui.event_ready, INFINITE);
|
| 145 |
|
| 146 |
return 0;
|
| 147 |
}
|
| 148 |
|
| 149 |
void static guiThread(void *param){
|
| 150 |
WNDCLASSEX wc;
|
| 151 |
|
| 152 |
MSG msg;
|
| 153 |
|
| 154 |
//InitCommonControls(); //by Greini it seems as if this command is obsolete and not more needed.
|
| 155 |
LoadLibrary("RichEd20.dll");
|
| 156 |
wc.cbSize = sizeof(WNDCLASSEX);
|
| 157 |
wc.style = CS_HREDRAW|CS_VREDRAW;
|
| 158 |
wc.lpfnWndProc = (WNDPROC)guiWndProc;
|
| 159 |
wc.cbClsExtra = 0;
|
| 160 |
wc.cbWndExtra = 0;
|
| 161 |
wc.hInstance = (HINSTANCE)param;
|
| 162 |
wc.hIcon = LoadIcon(wc.hInstance, MAKEINTRESOURCE(IDI_ICON1));
|
| 163 |
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
| 164 |
wc.hbrBackground = 0;
|
| 165 |
wc.lpszMenuName = MAKEINTRESOURCE(IDR_MENU);
|
| 166 |
wc.lpszClassName = "BnetdWndClass";
|
| 167 |
wc.hIconSm = NULL;
|
| 168 |
if(!RegisterClassEx( &wc )) guiDEAD("cant register WNDCLASS");
|
| 169 |
gui.hwnd = CreateWindowEx(
|
| 170 |
0,
|
| 171 |
wc.lpszClassName,
|
| 172 |
"The Player -vs- Player Gaming Network Server",
|
| 173 |
WS_OVERLAPPEDWINDOW,
|
| 174 |
CW_USEDEFAULT,
|
| 175 |
CW_USEDEFAULT,
|
| 176 |
CW_USEDEFAULT,
|
| 177 |
CW_USEDEFAULT,
|
| 178 |
NULL,
|
| 179 |
NULL,
|
| 180 |
(HINSTANCE)param,
|
| 181 |
NULL);
|
| 182 |
if(!gui.hwnd) guiDEAD("cant create window");
|
| 183 |
|
| 184 |
ShowWindow(gui.hwnd, SW_SHOW);
|
| 185 |
SetEvent(gui.event_ready);
|
| 186 |
while( GetMessage( &msg, NULL, 0, 0 ) ){
|
| 187 |
TranslateMessage( &msg );
|
| 188 |
DispatchMessage( &msg );
|
| 189 |
}
|
| 190 |
|
| 191 |
}
|
| 192 |
|
| 193 |
//by Greini Eventhandler return value is changed cause VS produced a Type Error
|
| 194 |
//LRESULT CALLBACK static guiWndProc(
|
| 195 |
long PASCAL guiWndProc(
|
| 196 |
HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
|
| 197 |
|
| 198 |
gui.wParam = wParam;
|
| 199 |
gui.lParam = lParam;
|
| 200 |
switch(message){
|
| 201 |
|
| 202 |
HANDLE_MSG(hwnd, WM_CREATE, guiOnCreate);
|
| 203 |
HANDLE_MSG(hwnd, WM_COMMAND, guiOnCommand);
|
| 204 |
HANDLE_MSG(hwnd, WM_MENUSELECT, guiOnMenuSelect);
|
| 205 |
HANDLE_MSG(hwnd, WM_SIZE, guiOnSize);
|
| 206 |
HANDLE_MSG(hwnd, WM_CLOSE, guiOnClose);
|
| 207 |
HANDLE_MSG(hwnd, WM_PAINT, guiOnPaint);
|
| 208 |
HANDLE_MSG(hwnd, WM_SETCURSOR, guiOnSetCursor);
|
| 209 |
HANDLE_MSG(hwnd, WM_LBUTTONDOWN, guiOnLButtonDown);
|
| 210 |
HANDLE_MSG(hwnd, WM_LBUTTONUP, guiOnLButtonUp);
|
| 211 |
HANDLE_MSG(hwnd, WM_MOUSEMOVE, guiOnMouseMove);
|
| 212 |
case WM_CAPTURECHANGED:
|
| 213 |
guiOnCaptureChanged((HWND)lParam);
|
| 214 |
return 0;
|
| 215 |
case WM_SHELLNOTIFY:
|
| 216 |
return guiOnShellNotify(wParam, lParam);
|
| 217 |
}
|
| 218 |
return DefWindowProc(hwnd, message, wParam, lParam);
|
| 219 |
}
|
| 220 |
|
| 221 |
|
| 222 |
BOOL static guiOnCreate(HWND hwnd, LPCREATESTRUCT lpCreateStruct){
|
| 223 |
|
| 224 |
gui.hwndConsole = CreateWindowEx(
|
| 225 |
0,
|
| 226 |
RICHEDIT_CLASS,
|
| 227 |
NULL,
|
| 228 |
WS_CHILD|WS_VISIBLE|ES_READONLY|ES_MULTILINE|WS_VSCROLL|WS_HSCROLL|ES_NOHIDESEL,
|
| 229 |
0, 0,
|
| 230 |
0, 0,
|
| 231 |
hwnd,
|
| 232 |
0,
|
| 233 |
0,
|
| 234 |
NULL);
|
| 235 |
if(!gui.hwndConsole) return FALSE;
|
| 236 |
|
| 237 |
// by amadeo: changed the userlist from riched-field to listbox
|
| 238 |
gui.hwndUsers = CreateWindowEx(
|
| 239 |
WS_EX_CLIENTEDGE,
|
| 240 |
"LISTBOX",
|
| 241 |
NULL,
|
| 242 |
WS_CHILD|WS_VISIBLE|LBS_STANDARD|LBS_NOINTEGRALHEIGHT,
|
| 243 |
0, 0,
|
| 244 |
0, 0,
|
| 245 |
hwnd,
|
| 246 |
0,
|
| 247 |
0,
|
| 248 |
NULL);
|
| 249 |
if(!gui.hwndUsers) return FALSE;
|
| 250 |
|
| 251 |
//amadeo: temp. button for useredit until rightcklick is working....
|
| 252 |
|
| 253 |
gui.hwndUserEditButton = CreateWindow(
|
| 254 |
"button",
|
| 255 |
"Edit User Status",
|
| 256 |
WS_CHILD | WS_VISIBLE | ES_LEFT,
|
| 257 |
0, 0,
|
| 258 |
0, 0,
|
| 259 |
hwnd,
|
| 260 |
(HMENU) 881,
|
| 261 |
0,
|
| 262 |
NULL) ;
|
| 263 |
if(!gui.hwndUserEditButton) return FALSE;
|
| 264 |
|
| 265 |
gui.hwndUserCount = CreateWindowEx(
|
| 266 |
WS_EX_CLIENTEDGE,
|
| 267 |
"edit",
|
| 268 |
" 0 user(s) online:",
|
| 269 |
WS_CHILD|WS_VISIBLE|ES_CENTER|ES_READONLY,
|
| 270 |
0, 0,
|
| 271 |
0, 0,
|
| 272 |
hwnd,
|
| 273 |
0,
|
| 274 |
0,
|
| 275 |
NULL);
|
| 276 |
if(!gui.hwndUserCount) return FALSE;
|
| 277 |
SendMessage(gui.hwndUserCount, WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
| 278 |
SendMessage(gui.hwndUsers, WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
| 279 |
SendMessage(gui.hwndUserEditButton, WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
| 280 |
BringWindowToTop(gui.hwndUsers);
|
| 281 |
strcpy( gui.szDefaultStatus, "Void" );
|
| 282 |
// by greini CreateStatusWindow only creates errors under winxp
|
| 283 |
/*gui.hwndStatus = CreateStatusWindow(
|
| 284 |
WS_CHILD | WS_VISIBLE,
|
| 285 |
gui.szDefaultStatus,
|
| 286 |
hwnd,
|
| 287 |
0);
|
| 288 |
if( !gui.hwndStatus ) return FALSE;*/
|
| 289 |
|
| 290 |
// by amadeo commented the code out, because it's not used anymore with resource.rc
|
| 291 |
/*gui.hmenuTray = CreatePopupMenu();
|
| 292 |
AppendMenu(gui.hmenuTray, MF_STRING, IDM_RESTORE, "&Restore");
|
| 293 |
AppendMenu(gui.hmenuTray, MF_SEPARATOR, 0, 0);
|
| 294 |
AppendMenu(gui.hmenuTray, MF_STRING, IDM_EXIT, "E&xit");
|
| 295 |
SetMenuDefaultItem(gui.hmenuTray, IDM_RESTORE, FALSE);*/
|
| 296 |
//by amadeo made changes to adapt to new layout
|
| 297 |
gui.y_ratio = (100<<10)/100;
|
| 298 |
gui.x_ratio = (0<<10)/100;
|
| 299 |
|
| 300 |
return TRUE;
|
| 301 |
}
|
| 302 |
|
| 303 |
|
| 304 |
void static guiOnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
|
| 305 |
{
|
| 306 |
|
| 307 |
if( id == IDM_EXIT )
|
| 308 |
guiOnClose(hwnd);
|
| 309 |
else if( id == IDM_SAVE )
|
| 310 |
server_save_wraper();
|
| 311 |
else if( id == IDM_RESTART )
|
| 312 |
server_restart_wraper();
|
| 313 |
else if( id == IDM_SHUTDOWN )
|
| 314 |
server_quit_wraper();
|
| 315 |
else if( id == IDM_CLEAR )
|
| 316 |
guiClearLogWindow();
|
| 317 |
else if( id == IDM_RESTORE )
|
| 318 |
guiOnShellNotify(IDI_TRAY, WM_LBUTTONDBLCLK);
|
| 319 |
//by greini catchs events from Update Userlist in the gui-Menu
|
| 320 |
else if(id == IDM_USERLIST)
|
| 321 |
guiOnUpdateUserList();
|
| 322 |
//by amadeo opens the editor with the server-config-file
|
| 323 |
else if(id == IDM_SERVERCONFIG)
|
| 324 |
guiOnServerConfig ();
|
| 325 |
//by amadeo displays the about-box
|
| 326 |
else if(id == IDM_ABOUT)
|
| 327 |
guiOnAbout (hwnd);
|
| 328 |
//by amadeo opens www.pvpgn.org
|
| 329 |
else if(id == ID_HELP_CHECKFORUPDATES)
|
| 330 |
guiOnUpdates ();
|
| 331 |
//by amadeo & honni opens announcement dialog
|
| 332 |
else if(id == IDM_ANN)
|
| 333 |
guiOnAnnounce (hwnd);
|
| 334 |
//by amadeo: admin-control-panel
|
| 335 |
else if(id == ID_USERACTIONS_KICKUSER)
|
| 336 |
guiOnUserStatusChange(hwnd);
|
| 337 |
else if(id == 881)
|
| 338 |
guiOnUserStatusChange(hwnd);
|
| 339 |
}
|
| 340 |
|
| 341 |
|
| 342 |
void static guiOnMenuSelect(HWND hwnd, HMENU hmenu, int item, HMENU hmenuPopup, UINT flags){
|
| 343 |
// char str[256];
|
| 344 |
//by greini
|
| 345 |
/*if( item == 0 || flags == -1)
|
| 346 |
SetWindowText( gui.hwndStatus, gui.szDefaultStatus );
|
| 347 |
else{
|
| 348 |
LoadString( GetWindowInstance(hwnd), item, str, sizeof(str) );
|
| 349 |
if( str[0] ) SetWindowText( gui.hwndStatus, str );
|
| 350 |
}*/
|
| 351 |
}
|
| 352 |
|
| 353 |
|
| 354 |
int static guiOnShellNotify(int uID, int uMessage){
|
| 355 |
|
| 356 |
if(uID == IDI_TRAY){
|
| 357 |
if(uMessage == WM_LBUTTONDBLCLK){
|
| 358 |
if( !IsWindowVisible(gui.hwnd) )
|
| 359 |
ShowWindow(gui.hwnd, SW_RESTORE);
|
| 360 |
SetForegroundWindow(gui.hwnd);
|
| 361 |
}else if(uMessage == WM_RBUTTONDOWN){
|
| 362 |
POINT cp;
|
| 363 |
GetCursorPos(&cp);
|
| 364 |
SetForegroundWindow(gui.hwnd);
|
| 365 |
TrackPopupMenu(gui.hmenuTray, TPM_LEFTALIGN|TPM_LEFTBUTTON, cp.x, cp.y,
|
| 366 |
0, gui.hwnd, NULL);
|
| 367 |
|
| 368 |
}
|
| 369 |
|
| 370 |
}
|
| 371 |
return 0;
|
| 372 |
}
|
| 373 |
|
| 374 |
|
| 375 |
void static guiOnPaint(HWND hwnd){
|
| 376 |
PAINTSTRUCT ps;
|
| 377 |
HDC dc;
|
| 378 |
|
| 379 |
dc = BeginPaint(hwnd, &ps);
|
| 380 |
|
| 381 |
DrawEdge(dc, &gui.rectHDivider, BDR_SUNKEN, BF_MIDDLE);
|
| 382 |
DrawEdge(dc, &gui.rectConsoleEdge, BDR_SUNKEN, BF_RECT);
|
| 383 |
DrawEdge(dc, &gui.rectUsersEdge, BDR_SUNKEN, BF_RECT);
|
| 384 |
|
| 385 |
EndPaint(hwnd, &ps);
|
| 386 |
//amadeo
|
| 387 |
UpdateWindow(gui.hwndConsole);
|
| 388 |
UpdateWindow(gui.hwndUsers);
|
| 389 |
UpdateWindow(gui.hwndUserCount);
|
| 390 |
UpdateWindow(gui.hwndUserEditButton);
|
| 391 |
|
| 392 |
//by greini
|
| 393 |
//UpdateWindow(gui.hwndStatus);
|
| 394 |
}
|
| 395 |
|
| 396 |
|
| 397 |
void static guiOnClose(HWND hwnd){
|
| 398 |
|
| 399 |
guiKillTrayIcon();
|
| 400 |
if( !gui.main_finished ){
|
| 401 |
eventlog(eventlog_level_debug,__FUNCTION__,"GUI wants server dead...");
|
| 402 |
exit(0);
|
| 403 |
}else{
|
| 404 |
eventlog(eventlog_level_debug,__FUNCTION__,"GUI wants to exit...");
|
| 405 |
SetEvent(gui.event_ready);
|
| 406 |
}
|
| 407 |
|
| 408 |
}
|
| 409 |
|
| 410 |
|
| 411 |
void static guiOnSize(HWND hwnd, UINT state, int cx, int cy){
|
| 412 |
int cy_console, cy_edge, cx_edge, cy_frame, cy_status;
|
| 413 |
|
| 414 |
if( state == SIZE_MINIMIZED ){
|
| 415 |
NOTIFYICONDATA dta;
|
| 416 |
|
| 417 |
dta.cbSize = sizeof(NOTIFYICONDATA);
|
| 418 |
dta.hWnd = hwnd;
|
| 419 |
dta.uID = IDI_TRAY;
|
| 420 |
dta.uFlags = NIF_ICON|NIF_MESSAGE|NIF_TIP;
|
| 421 |
dta.uCallbackMessage = WM_SHELLNOTIFY;
|
| 422 |
dta.hIcon = LoadIcon(GetWindowInstance(hwnd), MAKEINTRESOURCE(IDI_ICON1));
|
| 423 |
strcpy(dta.szTip, "PvPGN");
|
| 424 |
strcat(dta.szTip, " ");
|
| 425 |
strcat(dta.szTip, PVPGN_VERSION);
|
| 426 |
|
| 427 |
Shell_NotifyIcon(NIM_ADD, &dta);
|
| 428 |
ShowWindow(hwnd, SW_HIDE);
|
| 429 |
return;
|
| 430 |
}
|
| 431 |
if (state == SIZE_RESTORED)
|
| 432 |
{
|
| 433 |
NOTIFYICONDATA dta;
|
| 434 |
|
| 435 |
dta.hWnd = hwnd;
|
| 436 |
dta.uID = IDI_TRAY;
|
| 437 |
Shell_NotifyIcon(NIM_DELETE,&dta);
|
| 438 |
}
|
| 439 |
|
| 440 |
//by greini
|
| 441 |
//SendMessage( gui.hwndStatus, WM_SIZE, 0, 0);
|
| 442 |
//GetWindowRect( gui.hwndStatus, &rs );
|
| 443 |
//cy_status = rs.bottom - rs.top;
|
| 444 |
|
| 445 |
//by amadeo changed the whole fuckin' layout
|
| 446 |
cy_status = 0;
|
| 447 |
cy_edge = GetSystemMetrics(SM_CYEDGE);
|
| 448 |
cx_edge = GetSystemMetrics(SM_CXEDGE);
|
| 449 |
cy_frame = (cy_edge<<1) + GetSystemMetrics(SM_CYBORDER) + 1;
|
| 450 |
|
| 451 |
cy_console = ((cy-cy_status-cy_frame-cy_edge*2)*gui.y_ratio)>>10;
|
| 452 |
|
| 453 |
gui.rectConsoleEdge.left = 0;
|
| 454 |
gui.rectConsoleEdge.right = cx -140;
|
| 455 |
gui.rectConsoleEdge.top = 0;
|
| 456 |
gui.rectConsoleEdge.bottom = cy - cy_status;
|
| 457 |
|
| 458 |
gui.rectConsole.left = cx_edge;
|
| 459 |
gui.rectConsole.right = cx - 140 -cx_edge;
|
| 460 |
gui.rectConsole.top = cy_edge;
|
| 461 |
gui.rectConsole.bottom = cy - cy_status;
|
| 462 |
|
| 463 |
gui.rectUsersEdge.left = cx - 140;
|
| 464 |
gui.rectUsersEdge.top = 18;
|
| 465 |
gui.rectUsersEdge.right = cx;
|
| 466 |
gui.rectUsersEdge.bottom = cy - cy_status - 10;
|
| 467 |
|
| 468 |
gui.rectUsers.left = cx -138;
|
| 469 |
gui.rectUsers.right = cx ;
|
| 470 |
gui.rectUsers.top = 18 + cy_edge;
|
| 471 |
gui.rectUsers.bottom = cy - cy_status -20 ;
|
| 472 |
|
| 473 |
guiMoveWindow(gui.hwndConsole, &gui.rectConsole);
|
| 474 |
guiMoveWindow(gui.hwndUsers, &gui.rectUsers);
|
| 475 |
MoveWindow(gui.hwndUserCount, cx - 140, 0, 140, 18, TRUE);
|
| 476 |
MoveWindow(gui.hwndUserEditButton, cx - 140, cy - cy_status -20, 140, 20, TRUE);
|
| 477 |
}
|
| 478 |
|
| 479 |
|
| 480 |
BOOL static guiOnSetCursor(HWND hwnd, HWND hwndCursor, UINT codeHitTest, UINT msg){
|
| 481 |
POINT p;
|
| 482 |
|
| 483 |
if(hwnd == hwndCursor && codeHitTest == HTCLIENT){
|
| 484 |
GetCursorPos(&p);
|
| 485 |
ScreenToClient(hwnd, &p);
|
| 486 |
if(PtInRect(&gui.rectHDivider, p)) SetCursor(LoadCursor(0, IDC_SIZENS));
|
| 487 |
return TRUE;
|
| 488 |
}
|
| 489 |
|
| 490 |
return FORWARD_WM_SETCURSOR(hwnd, hwndCursor, codeHitTest, msg, DefWindowProc);
|
| 491 |
}
|
| 492 |
|
| 493 |
|
| 494 |
void static guiOnLButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags){
|
| 495 |
POINT p;
|
| 496 |
|
| 497 |
p.x = x;
|
| 498 |
p.y = y;
|
| 499 |
|
| 500 |
if( PtInRect(&gui.rectHDivider, p) ){
|
| 501 |
SetCapture(hwnd);
|
| 502 |
gui.mode |= MODE_HDIVIDE;
|
| 503 |
}
|
| 504 |
}
|
| 505 |
|
| 506 |
|
| 507 |
void static guiOnLButtonUp(HWND hwnd, int x, int y, UINT keyFlags){
|
| 508 |
ReleaseCapture();
|
| 509 |
gui.mode &= ~(MODE_HDIVIDE|MODE_VDIVIDE);
|
| 510 |
}
|
| 511 |
|
| 512 |
|
| 513 |
void static guiOnCaptureChanged(HWND hwndNewCapture){
|
| 514 |
gui.mode &= ~(MODE_HDIVIDE|MODE_VDIVIDE);
|
| 515 |
}
|
| 516 |
|
| 517 |
|
| 518 |
void static guiOnMouseMove(HWND hwnd, int x, int y, UINT keyFlags){
|
| 519 |
int offset, cy_console, cy_users;
|
| 520 |
RECT r;
|
| 521 |
|
| 522 |
if( gui.mode & MODE_HDIVIDE ){
|
| 523 |
offset = y - gui.rectHDivider.top;
|
| 524 |
if( !offset ) return;
|
| 525 |
cy_console = gui.rectConsole.bottom - gui.rectConsole.top;
|
| 526 |
cy_users = gui.rectUsers.bottom - gui.rectUsers.top;
|
| 527 |
|
| 528 |
if( cy_console + offset <= 0)
|
| 529 |
offset = -cy_console;
|
| 530 |
else if( cy_users - offset <= 0)
|
| 531 |
offset = cy_users;
|
| 532 |
|
| 533 |
cy_console += offset;
|
| 534 |
cy_users -= offset;
|
| 535 |
if( cy_console + cy_users == 0 ) return;
|
| 536 |
gui.y_ratio = (cy_console<<10) / (cy_console + cy_users);
|
| 537 |
GetClientRect(hwnd, &r);
|
| 538 |
guiOnSize(hwnd, 0, r.right, r.bottom);
|
| 539 |
InvalidateRect(hwnd, NULL, FALSE);
|
| 540 |
}
|
| 541 |
|
| 542 |
}
|
| 543 |
|
| 544 |
|
| 545 |
int extern gui_printf(const char *format, ...){
|
| 546 |
va_list arglist;
|
| 547 |
va_start(arglist, format);
|
| 548 |
return gui_lvprintf(eventlog_level_error, format, arglist);
|
| 549 |
}
|
| 550 |
|
| 551 |
|
| 552 |
int extern gui_lprintf(t_eventlog_level l, const char *format, ...){
|
| 553 |
va_list arglist;
|
| 554 |
va_start(arglist, format);
|
| 555 |
return gui_lvprintf(l, format, arglist);
|
| 556 |
}
|
| 557 |
|
| 558 |
int extern gui_lvprintf(t_eventlog_level l, const char *format, va_list arglist){
|
| 559 |
char buff[4096];
|
| 560 |
int result;
|
| 561 |
COLORREF clr;
|
| 562 |
|
| 563 |
result = vsprintf(buff, format, arglist);
|
| 564 |
|
| 565 |
switch(l){
|
| 566 |
case eventlog_level_none:
|
| 567 |
clr = RGB(0, 0, 0);
|
| 568 |
break;
|
| 569 |
case eventlog_level_trace:
|
| 570 |
clr = RGB(255, 0, 255);
|
| 571 |
break;
|
| 572 |
case eventlog_level_debug:
|
| 573 |
clr = RGB(0, 0, 255);
|
| 574 |
break;
|
| 575 |
case eventlog_level_info:
|
| 576 |
clr = RGB(0, 0, 0);
|
| 577 |
break;
|
| 578 |
case eventlog_level_warn:
|
| 579 |
clr = RGB(255, 128, 64);
|
| 580 |
break;
|
| 581 |
case eventlog_level_error:
|
| 582 |
clr = RGB(255, 0, 0);
|
| 583 |
break;
|
| 584 |
case eventlog_level_fatal:
|
| 585 |
clr = RGB(255, 0, 0);
|
| 586 |
break;
|
| 587 |
default:
|
| 588 |
clr = RGB(0, 0, 0);
|
| 589 |
}
|
| 590 |
|
| 591 |
guiAddText(buff, clr);
|
| 592 |
return result;
|
| 593 |
}
|
| 594 |
|
| 595 |
|
| 596 |
void static guiOnUpdates () //by amadeo opens the pvpgn-website
|
| 597 |
{
|
| 598 |
|
| 599 |
ShellExecute(NULL, "open", "www.pvpgn.org", NULL, NULL, SW_SHOW );
|
| 600 |
}
|
| 601 |
//by amadeo&honni announcement box
|
| 602 |
void static guiOnAnnounce (HWND hwnd) //by amadeo&honni announcement box
|
| 603 |
{
|
| 604 |
//DialogBox(hwnd, MAKEINTRESOURCE(IDD_ANN), NULL, AnnDlgProc);
|
| 605 |
DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_ANN), hwnd, (DLGPROC)AnnDlgProc);
|
| 606 |
}
|
| 607 |
|
| 608 |
|
| 609 |
//amadeo: admin-control-panel
|
| 610 |
void static guiOnUserStatusChange (HWND hwnd)
|
| 611 |
{
|
| 612 |
int index;
|
| 613 |
index = SendMessage(gui.hwndUsers, LB_GETCURSEL, 0, 0);
|
| 614 |
SendMessage(gui.hwndUsers, LB_GETTEXT, index, (LPARAM)selected_item);
|
| 615 |
DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_KICKUSER), hwnd, (DLGPROC)KickDlgProc);
|
| 616 |
SendMessage(gui.hwndUsers, LB_SETCURSEL, -1, 0);
|
| 617 |
|
| 618 |
}
|
| 619 |
void static guiOnAbout (HWND hwnd) //by amadeo displays the about-dialog
|
| 620 |
{
|
| 621 |
DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_ABOUT), hwnd, (DLGPROC)AboutDlgProc);
|
| 622 |
}
|
| 623 |
//by amadeo executes notepad to edit the server-config.
|
| 624 |
void static guiOnServerConfig()
|
| 625 |
{
|
| 626 |
ShellExecute(NULL, "open", "notepad.exe", "conf\\bnetd.conf", NULL, SW_SHOW );
|
| 627 |
}
|
| 628 |
//by amadeo: new userlist-handle (based on greini's richedit-window handle)
|
| 629 |
void extern guiOnUpdateUserList()
|
| 630 |
{
|
| 631 |
t_connection * c;
|
| 632 |
t_elem const * curr;
|
| 633 |
t_account * acc;
|
| 634 |
|
| 635 |
SendMessage(gui.hwndUsers, LB_RESETCONTENT, 0, 0);
|
| 636 |
|
| 637 |
LIST_TRAVERSE_CONST(connlist(),curr)
|
| 638 |
{
|
| 639 |
//the connectionstruct is nearly empty it only contains a link on an accountstruct
|
| 640 |
//amadeo fixes some crashes
|
| 641 |
if (!(c = elem_get_data(curr))) continue;
|
| 642 |
if (!(acc = conn_get_account(c))) continue;
|
| 643 |
|
| 644 |
SendMessage(gui.hwndUsers, LB_ADDSTRING, 0, (LPARAM)account_get_name(acc));
|
| 645 |
|
| 646 |
//sessionkey follows
|
| 647 |
|
| 648 |
}//amadeo updates USerCount
|
| 649 |
sprintf(UserCount, "%d", connlist_login_get_length());
|
| 650 |
strcat (UserCount, " user(s) online:");
|
| 651 |
SendMessage(gui.hwndUserCount,WM_SETTEXT,0,(LPARAM)UserCount);
|
| 652 |
}
|
| 653 |
/* by amadeo: should not be needed anymore...
|
| 654 |
//by amadeo writes userlist
|
| 655 |
void static guiAddText_user (const char *str, COLORREF clr){
|
| 656 |
int start_lines, text_length, end_lines;
|
| 657 |
CHARRANGE cr;
|
| 658 |
CHARFORMAT fmt;
|
| 659 |
start_lines = SendMessage(gui.hwndUsers, EM_GETLINECOUNT,0,0);
|
| 660 |
text_length = SendMessage(gui.hwndUsers, WM_GETTEXTLENGTH, 0, 0);
|
| 661 |
cr.cpMin = text_length;
|
| 662 |
cr.cpMax = text_length;
|
| 663 |
SendMessage(gui.hwndUsers, EM_EXSETSEL, 0, (LPARAM)&cr);
|
| 664 |
|
| 665 |
fmt.cbSize = sizeof(CHARFORMAT);
|
| 666 |
fmt.dwMask = CFM_COLOR|CFM_FACE|CFM_SIZE|
|
| 667 |
CFM_BOLD|CFM_ITALIC|CFM_STRIKEOUT|CFM_UNDERLINE;
|
| 668 |
fmt.yHeight = 160;
|
| 669 |
fmt.dwEffects = 0;
|
| 670 |
fmt.crTextColor = clr;
|
| 671 |
strcpy(fmt.szFaceName,"Courier New");
|
| 672 |
|
| 673 |
SendMessage(gui.hwndUsers, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&fmt);
|
| 674 |
SendMessage(gui.hwndUsers, EM_REPLACESEL, FALSE, (LPARAM)str);
|
| 675 |
end_lines = SendMessage(gui.hwndUsers, EM_GETLINECOUNT,0,0);
|
| 676 |
|
| 677 |
SendMessage(gui.hwndUsers, EM_LINESCROLL, 0, end_lines - start_lines);
|
| 678 |
}
|
| 679 |
*/
|
| 680 |
void static guiAddText(const char *str, COLORREF clr){
|
| 681 |
int start_lines, text_length, end_lines;
|
| 682 |
CHARRANGE cr;
|
| 683 |
CHARRANGE ds;
|
| 684 |
CHARFORMAT fmt;
|
| 685 |
text_length = SendMessage(gui.hwndConsole, WM_GETTEXTLENGTH, 0, 0);
|
| 686 |
if ( text_length >30000 ){
|
| 687 |
ds.cpMin = 0;
|
| 688 |
ds.cpMax = text_length - 30000;
|
| 689 |
SendMessage(gui.hwndConsole, EM_EXSETSEL, 0, (LPARAM)&ds);
|
| 690 |
SendMessage(gui.hwndConsole, EM_REPLACESEL, FALSE, 0);
|
| 691 |
}
|
| 692 |
|
| 693 |
cr.cpMin = text_length;
|
| 694 |
cr.cpMax = text_length;
|
| 695 |
SendMessage(gui.hwndConsole, EM_EXSETSEL, 0, (LPARAM)&cr);
|
| 696 |
|
| 697 |
fmt.cbSize = sizeof(CHARFORMAT);
|
| 698 |
fmt.dwMask = CFM_COLOR|CFM_FACE|CFM_SIZE|
|
| 699 |
CFM_BOLD|CFM_ITALIC|CFM_STRIKEOUT|CFM_UNDERLINE;
|
| 700 |
fmt.yHeight = 160;
|
| 701 |
fmt.dwEffects = 0;
|
| 702 |
fmt.crTextColor = clr;
|
| 703 |
strcpy(fmt.szFaceName,"Courier New");
|
| 704 |
|
| 705 |
SendMessage(gui.hwndConsole, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&fmt);
|
| 706 |
SendMessage(gui.hwndConsole, EM_REPLACESEL, FALSE, (LPARAM)str);
|
| 707 |
}
|
| 708 |
|
| 709 |
|
| 710 |
|
| 711 |
void static guiDEAD(char *message){
|
| 712 |
char *nl;
|
| 713 |
char errorStr[4096];
|
| 714 |
char *msgLastError;
|
| 715 |
|
| 716 |
FormatMessage(
|
| 717 |
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
| 718 |
NULL,
|
| 719 |
GetLastError(),
|
| 720 |
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
| 721 |
(LPTSTR) &msgLastError,
|
| 722 |
0,
|
| 723 |
NULL);
|
| 724 |
|
| 725 |
nl = strchr(msgLastError, '\r');
|
| 726 |
if(nl) *nl = 0;
|
| 727 |
|
| 728 |
sprintf(errorStr,
|
| 729 |
"%s\n"
|
| 730 |
"GetLastError() = '%s'\n",
|
| 731 |
message, msgLastError);
|
| 732 |
|
| 733 |
LocalFree(msgLastError);
|
| 734 |
MessageBox(0, errorStr, "guiDEAD", MB_ICONSTOP|MB_OK);
|
| 735 |
exit(1);
|
| 736 |
}
|
| 737 |
|
| 738 |
|
| 739 |
void static guiMoveWindow(HWND hwnd, RECT* r){
|
| 740 |
MoveWindow(hwnd, r->left, r->top, r->right-r->left, r->bottom-r->top, TRUE);
|
| 741 |
}
|
| 742 |
|
| 743 |
|
| 744 |
void static guiClearLogWindow(void){
|
| 745 |
SendMessage(gui.hwndConsole, WM_SETTEXT, 0, 0);
|
| 746 |
}
|
| 747 |
|
| 748 |
|
| 749 |
void static guiKillTrayIcon(void){
|
| 750 |
NOTIFYICONDATA dta;
|
| 751 |
|
| 752 |
dta.cbSize = sizeof(NOTIFYICONDATA);
|
| 753 |
dta.hWnd = gui.hwnd;
|
| 754 |
dta.uID = IDI_TRAY;
|
| 755 |
dta.uFlags = 0;
|
| 756 |
Shell_NotifyIcon(NIM_DELETE, &dta);
|
| 757 |
}
|
| 758 |
//amadeo message-handler for about-box
|
| 759 |
BOOL CALLBACK AboutDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
| 760 |
{
|
| 761 |
switch(Message)
|
| 762 |
{
|
| 763 |
case WM_INITDIALOG:
|
| 764 |
|
| 765 |
return TRUE;
|
| 766 |
case WM_COMMAND:
|
| 767 |
switch(LOWORD(wParam))
|
| 768 |
{
|
| 769 |
case IDOK:
|
| 770 |
EndDialog(hwnd, IDOK);
|
| 771 |
break;
|
| 772 |
|
| 773 |
}
|
| 774 |
break;
|
| 775 |
default:
|
| 776 |
return FALSE;
|
| 777 |
}
|
| 778 |
return TRUE;
|
| 779 |
}
|
| 780 |
|
| 781 |
// fixed version by dedef, fixing a mem leak
|
| 782 |
BOOL CALLBACK AnnDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
| 783 |
{
|
| 784 |
t_message *message; //dummy for message structure
|
| 785 |
switch(Message)
|
| 786 |
{
|
| 787 |
case WM_INITDIALOG:
|
| 788 |
return TRUE;
|
| 789 |
case WM_COMMAND:
|
| 790 |
switch(LOWORD(wParam))
|
| 791 |
{
|
| 792 |
case IDOK:
|
| 793 |
{
|
| 794 |
int len = GetWindowTextLength(GetDlgItem(hwnd, IDC_EDIT1));
|
| 795 |
if(len > 0)
|
| 796 |
{
|
| 797 |
char* buf;
|
| 798 |
buf = (char*)GlobalAlloc(GPTR, len + 1);
|
| 799 |
GetDlgItemText(hwnd, IDC_EDIT1, buf, len + 1);
|
| 800 |
|
| 801 |
//broadcasts the message
|
| 802 |
if ((message = message_create(message_type_error,NULL,NULL,buf)))
|
| 803 |
{
|
| 804 |
message_send_all(message);
|
| 805 |
message_destroy(message);
|
| 806 |
}
|
| 807 |
GlobalFree((HANDLE)buf);
|
| 808 |
SetDlgItemText(hwnd, IDC_EDIT1, "");
|
| 809 |
} else {
|
| 810 |
MessageBox(hwnd, "You didn't enter anything!", "Warning", MB_OK);
|
| 811 |
}
|
| 812 |
break;
|
| 813 |
}
|
| 814 |
}
|
| 815 |
break;
|
| 816 |
|
| 817 |
case WM_CLOSE:
|
| 818 |
// free the memory!
|
| 819 |
EndDialog(hwnd, IDOK);
|
| 820 |
break;
|
| 821 |
default:
|
| 822 |
return FALSE;
|
| 823 |
}
|
| 824 |
return TRUE;
|
| 825 |
}
|
| 826 |
|
| 827 |
//amadeo handler for Kick/Ban Users Box
|
| 828 |
BOOL CALLBACK KickDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
| 829 |
{
|
| 830 |
|
| 831 |
|
| 832 |
|
| 833 |
switch(Message)
|
| 834 |
{
|
| 835 |
case WM_INITDIALOG:
|
| 836 |
if (selected_item[0]!= 0)
|
| 837 |
{
|
| 838 |
SetDlgItemText(hwnd, IDC_EDITKICK, selected_item);
|
| 839 |
}
|
| 840 |
|
| 841 |
return TRUE;
|
| 842 |
case WM_COMMAND:
|
| 843 |
|
| 844 |
switch(LOWORD(wParam))
|
| 845 |
{
|
| 846 |
case IDC_KICK_EXECUTE:
|
| 847 |
{ //closed
|
| 848 |
|
| 849 |
BOOL messageq;
|
| 850 |
BOOL kickq;
|
| 851 |
char temp[60];
|
| 852 |
char ipadr[110];
|
| 853 |
messageq = FALSE;
|
| 854 |
kickq = FALSE;
|
| 855 |
GetDlgItemText(hwnd, IDC_EDITKICK, selected_item, 32);
|
| 856 |
|
| 857 |
conngui = connlist_find_connection_by_accountname(selected_item);
|
| 858 |
accountgui = accountlist_find_account(selected_item);
|
| 859 |
|
| 860 |
|
| 861 |
if (conngui == NULL)
|
| 862 |
{
|
| 863 |
strcat(selected_item," could not be found in Userlist!");
|
| 864 |
MessageBox(hwnd,selected_item,"ERROR", MB_OK);
|
| 865 |
}
|
| 866 |
else
|
| 867 |
{
|
| 868 |
|
| 869 |
|
| 870 |
|
| 871 |
hButton = GetDlgItem(hwnd, IDC_CHECKBAN);
|
| 872 |
hButton1 = GetDlgItem(hwnd, IDC_CHECKKICK);
|
| 873 |
hButton2 = GetDlgItem(hwnd, IDC_CHECKADMIN);
|
| 874 |
hButton3 = GetDlgItem(hwnd, IDC_CHECKMOD);
|
| 875 |
hButton4 = GetDlgItem(hwnd, IDC_CHECKANN);
|
| 876 |
|
| 877 |
//strcpy(gtrue,"true");
|
| 878 |
|
| 879 |
|
| 880 |
if (SendMessage(hButton2 , BM_GETCHECK, 0, 0)==BST_CHECKED)
|
| 881 |
{
|
| 882 |
account_set_admin(accountgui);
|
| 883 |
account_set_command_groups(accountgui, 255);
|
| 884 |
messageq = TRUE;
|
| 885 |
}
|
| 886 |
if (SendMessage(hButton3 , BM_GETCHECK, 0, 0)==BST_CHECKED)
|
| 887 |
{
|
| 888 |
account_set_auth_operator(accountgui,NULL,1);
|
| 889 |
messageq = TRUE;
|
| 890 |
}
|
| 891 |
if (SendMessage(hButton4 , BM_GETCHECK, 0, 0)==BST_CHECKED)
|
| 892 |
{
|
| 893 |
account_set_strattr(accountgui,"BNET\\auth\\announce",gtrue);
|
| 894 |
messageq = TRUE;
|
| 895 |
}
|
| 896 |
if (SendMessage(hButton , BM_GETCHECK, 0, 0)==BST_CHECKED)
|
| 897 |
{
|
| 898 |
|
| 899 |
|
| 900 |
strcpy (temp, addr_num_to_addr_str(conn_get_addr(conngui), 0)); //get the ip and cut port off
|
| 901 |
|
| 902 |
for (i_GUI=0; temp[i_GUI]!=':'; i_GUI++)
|
| 903 |
ipadr[i_GUI]=temp[i_GUI];
|
| 904 |
ipadr[i_GUI]= 0;
|
| 905 |
|
| 906 |
|
| 907 |
|
| 908 |
strcpy(temp," a ");
|
| 909 |
strcat(temp,ipadr);
|
| 910 |
|
| 911 |
handle_ipban_command(NULL,temp);
|
| 912 |
temp[0] = 0;
|
| 913 |
strcpy(temp," has been added to IpBanList");
|
| 914 |
strcat(ipadr,temp);
|
| 915 |
if (messageq == TRUE)
|
| 916 |
{
|
| 917 |
strcat(ipadr," and UserStatus changed");
|
| 918 |
MessageBox(hwnd,ipadr,"ipBan & StatusChange", MB_OK);
|
| 919 |
messageq = FALSE;
|
| 920 |
kickq = FALSE;
|
| 921 |
}
|
| 922 |
else
|
| 923 |
MessageBox(hwnd,ipadr,"ipBan", MB_OK);
|
| 924 |
}
|
| 925 |
if (SendMessage(hButton1 , BM_GETCHECK, 0, 0)==BST_CHECKED)
|
| 926 |
{
|
| 927 |
conn_set_state(conngui,conn_state_destroy);
|
| 928 |
kickq = TRUE;
|
| 929 |
}
|
| 930 |
if ((messageq == TRUE)&&(kickq == TRUE))
|
| 931 |
{
|
| 932 |
strcat (selected_item,"has been kicked and Status has changed");
|
| 933 |
MessageBox(hwnd,selected_item,"UserKick & StatusChange", MB_OK);
|
| 934 |
}
|
| 935 |
if ((kickq == TRUE)&&(messageq == FALSE))
|
| 936 |
{
|
| 937 |
strcat (selected_item," has been kicked from the server");
|
| 938 |
MessageBox(hwnd,selected_item,"UserKick", MB_OK);
|
| 939 |
}
|
| 940 |
if ((kickq == FALSE)&&(messageq == TRUE))
|
| 941 |
{
|
| 942 |
strcat (selected_item,"'s Status has been changed");
|
| 943 |
MessageBox(hwnd,selected_item,"StatusChange", MB_OK);
|
| 944 |
}
|
| 945 |
selected_item[0] = 0;
|
| 946 |
|
| 947 |
}
|
| 948 |
|
| 949 |
|
| 950 |
break;
|
| 951 |
|
| 952 |
}
|
| 953 |
|
| 954 |
}
|
| 955 |
|
| 956 |
break;
|
| 957 |
case WM_CLOSE:
|
| 958 |
EndDialog(hwnd, IDC_EDITKICK);
|
| 959 |
break;
|
| 960 |
default:
|
| 961 |
return FALSE;
|
| 962 |
}
|
| 963 |
return TRUE;
|
| 964 |
}
|
| 965 |
|
| 966 |
#endif
|