You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(102) |
Dec
(255) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(38) |
Feb
(16) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ma...@us...> - 2003-11-21 03:01:35
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv29751 Modified Files: Makefile wxInterface_private.rc Log Message: Minor make system modifications. Works better on win32 now. Index: Makefile =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Makefile,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- Makefile 20 Nov 2003 01:27:26 -0000 1.27 +++ Makefile 21 Nov 2003 03:01:32 -0000 1.28 @@ -1,8 +1,34 @@ -WXCONFIG = wx-config -CXX = $(shell $(WXCONFIG) --cxx) +# +++ Configuration settings section +++ -PROGRAM = wxInterface +# WXCONFIG should point to your wx-config file (usually at /usr/local/bin) +WXCONFIG = /wx/dynamic/2.4.2/bin/wxgtk-2.4-config + +# Don't modify these - automatically generated from WXCONFIG +CXX = $(shell $(WXCONFIG) --cxx) +CXX_FLAGS = $(shell $(WXCONFIG) --cxxflags) +LIBS = $(shell $(WXCONFIG) --libs) + +# Normal CPP flags +CPP_FLAGS = -O2 -pipe -I. -c -Wall +# Debugging CPP flags +DEBUG_FLAGS = -ggdb -pipe -I. -c -g -ggdb -Wall + +# Only needed on Win32 - Location of windres.exe file +WINDRES = windres.exe + +# Any extra include directives needed +INCLUDE_DIR = /local/include + +# Our own defines. Only one of meaning is -D__HAVE_REMOVE_GROWABLE_COL__, +# which should only be enabled if you have patched wxWindows with sizer.patch +DEFINES = -D__HAVE_REMOVE_GROWABLE_COL__ + +# Final binary name +PROGRAM = wxInterface + +# +++ Objects section +++ +# Objects list. If new files are added to source tree, add them here also. OBJECTS = ColorFrameCtrl.o \ DownloadListCtrl.o \ GUISettingsDlg.o \ @@ -27,22 +53,28 @@ UploadListCtrl.o \ wxInterface.o \ wxInterface_wdr.o \ -# wxInterface_private.res \ -# uncomment xmule2-ui-wx_private.res file under win32, -# comment out on all other systems. - -# implementation +# wxInterface_private.res +# wxInterface_private.res is needed only on win32 platform. Comment out +# on all other platforms. -.SUFFIXES: .o .cpp +# File suffixes +.SUFFIXES: .o .cpp .rc .res +# +++ Compilation/linking commands section +++ +# Compile commands. To make DEBUG build, add $(DEBUG_FLAGS) flag to this command. .cpp.o : - $(CXX) -O2 -pipe -g -I. -c -Wall -I"/local/include" `$(WXCONFIG) --cxxflags` -o $@ $< - -all: $(PROGRAM) + $(CXX) $(CPP_FLAGS) $(DEFINES) -I$(INCLUDE_DIR) $(CXX_FLAGS) -o $@ $< +.rc.res: + windres -i $< -I rc -o $@ -O coff --include-dir=$(INCLUDE_DIR) +# Linking command $(PROGRAM): $(OBJECTS) - $(CXX) -O2 -o $(PROGRAM) $(OBJECTS) `$(WXCONFIG) --libs` + $(CXX) -o $(PROGRAM) $(OBJECTS) $(LIBS) -clean: - rm -f *.o $(PROGRAM) +# +++ Building section +++ +# All builds program with default settings. +all: $(PROGRAM) +# Cleanup command +clean: + rm -f $(OBJECTS) $(PROGRAM) Index: wxInterface_private.rc =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/wxInterface_private.rc,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- wxInterface_private.rc 20 Nov 2003 01:27:26 -0000 1.1 +++ wxInterface_private.rc 21 Nov 2003 03:01:32 -0000 1.2 @@ -3,11 +3,11 @@ //#include "xmule2-ui-wx_private.rc" #include <wx/msw/wx.rc> -A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "xmule2-ui-wx.ico" +A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "wxInterface.ico" // // SUPPORT FOR WINDOWS XP THEMES: // THIS WILL MAKE THE PROGRAM USE THE COMMON CONTROLS // LIBRARY VERSION 6.0 (IF IT IS AVAILABLE) // -1 24 "wxInterface.exe.Manifest" +//1 24 "wxInterface.exe.Manifest" |
From: <ma...@us...> - 2003-11-21 02:56:00
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv29032 Modified Files: SBPanel.cpp Log Message: Fixes refreshing problem on win32. Index: SBPanel.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SBPanel.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- SBPanel.cpp 20 Nov 2003 01:27:26 -0000 1.2 +++ SBPanel.cpp 21 Nov 2003 02:55:55 -0000 1.3 @@ -96,7 +96,7 @@ GetParent()->GetSizer()->Layout(); ::wxGetTopLevelParent(this)->Layout(); - + GetParent()->Refresh(); } /** |
Update of /cvsroot/sharedaemon/core/src In directory sc8-pr-cvs1:/tmp/cvs-serv10697 Modified Files: Addr.cpp Addr.h Array.h Client.cpp Client.h ClientList.cpp ClientList.h ClientShadow.cpp ClientShadow.h Ed2kConnection.cpp Ed2kConnection.h Ed2kPacket.cpp Ed2kPacket.h Ed2kSocket.cpp Ed2kSocket.h File.h Makefile.cvs MultiLevelBitmap.cpp MultiLevelBitmap.h Packet.h ParseClass.cpp ParseClass.h Socket.cpp Socket.h debug.h mprintf.c mprintf.h osdep.cpp osdep.h parse-ed2k-xmule2.h parse-ed2k.c parse-ed2k.h test.cpp util.cpp util.h xmuletypes.h Log Message: Changed copyright notices to reflect project name change from xMule2 to ShareDaemon Index: Addr.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Addr.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Addr.cpp 20 Nov 2003 16:21:24 -0000 1.4 +++ Addr.cpp 20 Nov 2003 16:27:24 -0000 1.5 @@ -1,5 +1,5 @@ /* - * Addr.cpph. Part of the xMule project. + * Addr.cpp. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: Addr.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Addr.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Addr.h 20 Nov 2003 16:21:24 -0000 1.5 +++ Addr.h 20 Nov 2003 16:27:25 -0000 1.6 @@ -1,5 +1,5 @@ /* - * Addr.h. Part of the xMule project. + * Addr.h. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: Array.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Array.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Array.h 20 Nov 2003 16:21:24 -0000 1.5 +++ Array.h 20 Nov 2003 16:27:25 -0000 1.6 @@ -1,3 +1,23 @@ +/* + * Array.h. Part of the ShareDaemon project. + * + * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> + * + * 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 ARRAY_H #define ARRAY_H Index: Client.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Client.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- Client.cpp 20 Nov 2003 16:21:24 -0000 1.9 +++ Client.cpp 20 Nov 2003 16:27:25 -0000 1.10 @@ -1,5 +1,5 @@ /* - * Client.cpp. Part of the xMule project. + * Client.cpp. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: Client.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Client.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Client.h 20 Nov 2003 16:21:24 -0000 1.6 +++ Client.h 20 Nov 2003 16:27:25 -0000 1.7 @@ -1,5 +1,5 @@ /* - * Client.h. Part of the xMule project. + * Client.h. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: ClientList.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/ClientList.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ClientList.cpp 12 Aug 2003 10:35:16 -0000 1.4 +++ ClientList.cpp 20 Nov 2003 16:27:25 -0000 1.5 @@ -1,5 +1,5 @@ /* - * ClientList.cpp. Part of the xMule project. + * ClientList.cpp. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: ClientList.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/ClientList.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ClientList.h 12 Aug 2003 10:35:16 -0000 1.4 +++ ClientList.h 20 Nov 2003 16:27:25 -0000 1.5 @@ -1,5 +1,5 @@ /* - * ClientList.h. Part of the xMule project. + * ClientList.h. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: ClientShadow.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/ClientShadow.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ClientShadow.cpp 8 Sep 2003 00:31:54 -0000 1.4 +++ ClientShadow.cpp 20 Nov 2003 16:27:25 -0000 1.5 @@ -1,5 +1,5 @@ /* - * ClientShadow.cpp. Part of the xMule project. + * ClientShadow.cpp. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: ClientShadow.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/ClientShadow.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ClientShadow.h 8 Sep 2003 00:31:54 -0000 1.4 +++ ClientShadow.h 20 Nov 2003 16:27:25 -0000 1.5 @@ -1,5 +1,5 @@ /* - * ClientShadow.h. Part of the xMule project. + * ClientShadow.h. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: Ed2kConnection.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Ed2kConnection.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Ed2kConnection.cpp 20 Nov 2003 16:21:24 -0000 1.2 +++ Ed2kConnection.cpp 20 Nov 2003 16:27:25 -0000 1.3 @@ -1,5 +1,5 @@ /* - * Ed2kConnection.cpp. Part of the xMule project. + * Ed2kConnection.cpp. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: Ed2kConnection.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Ed2kConnection.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Ed2kConnection.h 20 Nov 2003 16:21:24 -0000 1.2 +++ Ed2kConnection.h 20 Nov 2003 16:27:25 -0000 1.3 @@ -1,5 +1,5 @@ /* - * Ed2kConnection.h. Part of the xMule project. + * Ed2kConnection.h. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: Ed2kPacket.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Ed2kPacket.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Ed2kPacket.cpp 20 Nov 2003 16:21:24 -0000 1.2 +++ Ed2kPacket.cpp 20 Nov 2003 16:27:25 -0000 1.3 @@ -1,5 +1,5 @@ /* - * Ed2kPacket.cpp. Part of the xMule project. + * Ed2kPacket.cpp. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: Ed2kPacket.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Ed2kPacket.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Ed2kPacket.h 20 Nov 2003 16:21:24 -0000 1.4 +++ Ed2kPacket.h 20 Nov 2003 16:27:25 -0000 1.5 @@ -1,5 +1,5 @@ /* - * Ed2kPacket.h. Part of the xMule project. + * Ed2kPacket.h. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: Ed2kSocket.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Ed2kSocket.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Ed2kSocket.cpp 20 Nov 2003 16:21:24 -0000 1.4 +++ Ed2kSocket.cpp 20 Nov 2003 16:27:25 -0000 1.5 @@ -1,5 +1,5 @@ /* - * Ed2kSocket.cpp. Part of the xMule project. + * Ed2kSocket.cpp. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: Ed2kSocket.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Ed2kSocket.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Ed2kSocket.h 29 Sep 2003 22:06:21 -0000 1.3 +++ Ed2kSocket.h 20 Nov 2003 16:27:25 -0000 1.4 @@ -1,5 +1,5 @@ /* - * Ed2kSocket.h. Part of the xMule project. + * Ed2kSocket.h. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: File.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/File.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- File.h 8 Aug 2003 19:23:03 -0000 1.3 +++ File.h 20 Nov 2003 16:27:25 -0000 1.4 @@ -1,7 +1,21 @@ /* - * File.h. Part of the xMule project. + * File.h. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> + * + * 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 FILE_H Index: Makefile.cvs =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Makefile.cvs,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Makefile.cvs 31 Oct 2003 21:00:13 -0000 1.7 +++ Makefile.cvs 20 Nov 2003 16:27:25 -0000 1.8 @@ -1,9 +1,22 @@ -#xMule2, Copyright (C) 2002 by Bodo Thiesen -#The package xMule2 comes with ABSOLUTELY NO WARRANTY; for -#details, see COPYING in the source tree of the sources. -#This is free software, and you are welcome to -#redistribute it under certain conditions; see the file -#COPYING in the source tree of the sources for details. +# +# Makefile.cvs. Part of the ShareDaemon project. +# +# Copyright (C) 2003 Bodo Thiesen <bo...@gm...> +# +# 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 +# all: test Index: MultiLevelBitmap.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/MultiLevelBitmap.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- MultiLevelBitmap.cpp 20 Nov 2003 16:21:24 -0000 1.5 +++ MultiLevelBitmap.cpp 20 Nov 2003 16:27:25 -0000 1.6 @@ -1,5 +1,5 @@ /* - * MultiLevelBitmap.cpp. Part of the xMule project. + * MultiLevelBitmap.cpp. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: MultiLevelBitmap.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/MultiLevelBitmap.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- MultiLevelBitmap.h 3 Sep 2003 15:58:15 -0000 1.4 +++ MultiLevelBitmap.h 20 Nov 2003 16:27:25 -0000 1.5 @@ -1,5 +1,5 @@ /* - * MultiLevelBitmap.h. Part of the xMule project. + * MultiLevelBitmap.h. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: Packet.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Packet.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Packet.h 29 Sep 2003 22:06:21 -0000 1.5 +++ Packet.h 20 Nov 2003 16:27:25 -0000 1.6 @@ -1,5 +1,5 @@ /* - * Packet.h. Part of the xMule project. + * Packet.h. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: ParseClass.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/ParseClass.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ParseClass.cpp 20 Nov 2003 16:21:24 -0000 1.7 +++ ParseClass.cpp 20 Nov 2003 16:27:25 -0000 1.8 @@ -1,5 +1,5 @@ /* - * ParseClass.cpp. Part of the xMule project. + * ParseClass.cpp. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: ParseClass.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/ParseClass.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ParseClass.h 20 Nov 2003 16:21:24 -0000 1.7 +++ ParseClass.h 20 Nov 2003 16:27:25 -0000 1.8 @@ -1,5 +1,5 @@ /* - * ParseClass.h. Part of the xMule project. + * ParseClass.h. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: Socket.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Socket.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- Socket.cpp 20 Nov 2003 16:21:24 -0000 1.10 +++ Socket.cpp 20 Nov 2003 16:27:25 -0000 1.11 @@ -1,5 +1,5 @@ /* - * Socket.cpp. Part of the xMule project. + * Socket.cpp. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: Socket.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Socket.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- Socket.h 20 Nov 2003 16:21:24 -0000 1.9 +++ Socket.h 20 Nov 2003 16:27:25 -0000 1.10 @@ -1,5 +1,5 @@ /* - * Socket.h. Part of the xMule project. + * Socket.h. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: debug.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/debug.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- debug.h 20 Nov 2003 16:21:24 -0000 1.5 +++ debug.h 20 Nov 2003 16:27:25 -0000 1.6 @@ -1,5 +1,5 @@ /* - * debug.h. Part of the xMule project. + * debug.h. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: mprintf.c =================================================================== RCS file: /cvsroot/sharedaemon/core/src/mprintf.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- mprintf.c 12 Oct 2003 21:11:52 -0000 1.1 +++ mprintf.c 20 Nov 2003 16:27:25 -0000 1.2 @@ -1,3 +1,23 @@ +/* + * mprintf.c. Part of the bothie-utils. + * + * Copyright (C) 2002, 2003 Bodo Thiesen <bo...@gm...> + * + * 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 "mprintf.h" #include <stdlib.h> Index: mprintf.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/mprintf.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- mprintf.h 12 Oct 2003 21:11:52 -0000 1.1 +++ mprintf.h 20 Nov 2003 16:27:25 -0000 1.2 @@ -1,3 +1,23 @@ +/* + * mprintf.h. Part of the bothie-utils. + * + * Copyright (C) 2002, 2003 Bodo Thiesen <bo...@gm...> + * + * 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 MPRINTF_H #define MPRINTF_H Index: osdep.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/osdep.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- osdep.cpp 20 Nov 2003 16:21:24 -0000 1.7 +++ osdep.cpp 20 Nov 2003 16:27:25 -0000 1.8 @@ -1,5 +1,5 @@ /* - * osdep.cpp. Part of the xMule project. + * osdep.cpp. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: osdep.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/osdep.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- osdep.h 20 Nov 2003 16:21:24 -0000 1.9 +++ osdep.h 20 Nov 2003 16:27:25 -0000 1.10 @@ -1,5 +1,5 @@ /* - * osdep.h. Part of the xMule project. + * osdep.h. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: parse-ed2k-xmule2.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/parse-ed2k-xmule2.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- parse-ed2k-xmule2.h 13 Oct 2003 23:02:42 -0000 1.2 +++ parse-ed2k-xmule2.h 20 Nov 2003 16:27:25 -0000 1.3 @@ -1,5 +1,5 @@ /* - * parse-ed2k.h. Part of the xMule project. + * parse-ed2k.h. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: parse-ed2k.c =================================================================== RCS file: /cvsroot/sharedaemon/core/src/parse-ed2k.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- parse-ed2k.c 20 Nov 2003 16:21:24 -0000 1.12 +++ parse-ed2k.c 20 Nov 2003 16:27:25 -0000 1.13 @@ -1,5 +1,5 @@ /* - * parse-ed2k.c. Part of the xMule project. + * parse-ed2k.c. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: parse-ed2k.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/parse-ed2k.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- parse-ed2k.h 20 Nov 2003 16:21:24 -0000 1.8 +++ parse-ed2k.h 20 Nov 2003 16:27:25 -0000 1.9 @@ -1,5 +1,5 @@ /* - * parse-ed2k.h. Part of the xMule project. + * parse-ed2k.h. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: test.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/test.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- test.cpp 20 Nov 2003 15:28:28 -0000 1.24 +++ test.cpp 20 Nov 2003 16:27:25 -0000 1.25 @@ -1,5 +1,5 @@ /* - * test.cpp. Part of the xMule project. + * test.cpp. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: util.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/util.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- util.cpp 20 Nov 2003 16:21:24 -0000 1.4 +++ util.cpp 20 Nov 2003 16:27:25 -0000 1.5 @@ -1,5 +1,5 @@ /* - * util.cpp. Part of the xMule project. + * util.cpp. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: util.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/util.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- util.h 20 Nov 2003 16:21:24 -0000 1.7 +++ util.h 20 Nov 2003 16:27:25 -0000 1.8 @@ -1,5 +1,5 @@ /* - * util.h. Part of the xMule project. + * util.h. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * Index: xmuletypes.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/xmuletypes.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- xmuletypes.h 26 Aug 2003 16:03:12 -0000 1.4 +++ xmuletypes.h 20 Nov 2003 16:27:25 -0000 1.5 @@ -1,5 +1,5 @@ /* - * xmuletypes.h. Part of the xMule project. + * xmuletypes.h. Part of the ShareDaemon project. * * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> * |
Update of /cvsroot/sharedaemon/core/src In directory sc8-pr-cvs1:/tmp/cvs-serv9377 Modified Files: Addr.cpp Addr.h Array.h Client.cpp Client.h Ed2kConnection.cpp Ed2kConnection.h Ed2kPacket.cpp Ed2kPacket.h Ed2kSocket.cpp MultiLevelBitmap.cpp ParseClass.cpp ParseClass.h Socket.cpp Socket.h debug.h osdep.cpp osdep.h parse-ed2k.c parse-ed2k.h util.cpp util.h Log Message: Reformatted very big amout of code to fit 80 CPL limit Index: Addr.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Addr.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Addr.cpp 29 Sep 2003 22:06:21 -0000 1.3 +++ Addr.cpp 20 Nov 2003 16:21:24 -0000 1.4 @@ -44,7 +44,9 @@ if (dns==next_dns || c>255 || *next_dns!='.') goto bad_ip; dns=++next_dns; d=strtoul(dns,&next_dns,10); - if (dns==next_dns || d>255 || (*next_dns && *next_dns!=':')) goto bad_ip; + if (dns==next_dns || d>255 || (*next_dns && *next_dns!=':')) { + goto bad_ip; + } SocketAddress.sin_family=AF_INET; SocketAddress.sin_port=htons(port); SocketAddress.sin_addr.s_addr=htonl(a<<24 | b<<16 | c<<8 | d); Index: Addr.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Addr.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Addr.h 12 Aug 2003 10:35:16 -0000 1.4 +++ Addr.h 20 Nov 2003 16:21:24 -0000 1.5 @@ -61,7 +61,13 @@ resolver_id=-1; } void SetPort(u16 port) { SocketAddress.sin_port=htons(port); } - void SetIP(u32 ip) { if (resolver_id!=-1) { close(resolver_id); resolver_id=-1; } SocketAddress.sin_addr.s_addr=htonl(ip); } + void SetIP(u32 ip) { + if (resolver_id!=-1) { + close(resolver_id); + resolver_id=-1; + } + SocketAddress.sin_addr.s_addr=htonl(ip); + } u32 GetIP() const { return ntohl(SocketAddress.sin_addr.s_addr); } u16 GetPort() const { return ntohs(SocketAddress.sin_port); } Index: Array.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Array.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Array.h 31 Oct 2003 21:00:11 -0000 1.4 +++ Array.h 20 Nov 2003 16:21:24 -0000 1.5 @@ -81,7 +81,9 @@ delete ptr_array[i]; } - new_ptr_array=(T**)realloc((void*)ptr_array,sizeof(T)*new_size); + new_ptr_array=(T**)realloc( + (void*)ptr_array,sizeof(T)*new_size + ); if (new_ptr_array || !new_size) { ptr_array=new_ptr_array; } @@ -93,7 +95,9 @@ T * * new_ptr_array; size_t i; - new_ptr_array=(T**)realloc((void*)ptr_array,sizeof(T*)*new_size); + new_ptr_array=(T**)realloc( + (void*)ptr_array,sizeof(T*)*new_size + ); if (!new_ptr_array) { throw std::bad_alloc(); } @@ -136,7 +140,9 @@ throw std::bad_alloc(); } - new_ptr_array=(T**)realloc((void*)ptr_array,sizeof(T*)*new_size); + new_ptr_array=(T**)realloc( + (void*)ptr_array,sizeof(T*)*new_size + ); if (!new_ptr_array) { throw std::bad_alloc(); } Index: Client.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Client.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Client.cpp 29 Sep 2003 22:06:21 -0000 1.8 +++ Client.cpp 20 Nov 2003 16:21:24 -0000 1.9 @@ -49,14 +49,16 @@ * * Warning: The vector ClientShadow::Vector is NOT sorted in any means. * - * hash == "" is the special InvalidClient. It's returned by other functions on - * Errors. + * hash == "" is the special InvalidClient. It's returned by other functions + * on Errors. */ Client Client::GetClientByHash(std::string hash) { ENTER(); if (Hash2Client_map.count(hash)) { - ClientShadow * fcs=&ClientShadow::Vector[Hash2Client_map[hash]]; + ClientShadow * fcs; + + fcs=&ClientShadow::Vector[Hash2Client_map[hash]]; if (fcs->GetHash()==hash) { RETURN(Client(*fcs)); } @@ -76,8 +78,9 @@ RETURN(Client(ClientShadow::Vector.end()[-1])); /* + std::vector<ClientShadow>::iterator i; for ( - std::vector<ClientShadow>::iterator i=ClientShadow::Vector.begin(); + i=ClientShadow::Vector.begin(); i!=ClientShadow::Vector.end(); ++i ) { @@ -103,7 +106,9 @@ first_call=false; // we=GetClientByHash("").we; -// ClientShadow::Vector.push_back(ClientShadow("",we=Hash2Client_map[""]=ClientShadow::Vector.size())); +// ClientShadow::Vector.push_back(ClientShadow( +// "",we=Hash2Client_map[""]=ClientShadow::Vector.size() +// )); // raise(SIGSTOP); Index: Client.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Client.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Client.h 12 Aug 2003 10:35:16 -0000 1.5 +++ Client.h 20 Nov 2003 16:21:24 -0000 1.6 @@ -63,9 +63,9 @@ static std::string FileName; public: /* - * This function must be called exactly once to load the file known.met. - * The filename will be remembered by the class to being able to write - * back the data if neccessary. + * This function must be called exactly once to load the file + * known.met. The filename will be remembered by the class to being + * able to write back the data if neccessary. */ static bool Init(std::string filename); /* @@ -78,8 +78,8 @@ public: Client(const Client & client); /* - * Returns the client with the given hash. If that client didn't exist before, - * it get's created. + * Returns the client with the given hash. If that client didn't exist + * before, it get's created. */ static Client GetClientByHash(std::string hash); static Client GetClientByEd2kLink(std::string ed2klink); Index: Ed2kConnection.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Ed2kConnection.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Ed2kConnection.cpp 31 Oct 2003 21:00:12 -0000 1.1 +++ Ed2kConnection.cpp 20 Nov 2003 16:21:24 -0000 1.2 @@ -1,3 +1,23 @@ +/* + * Ed2kConnection.cpp. Part of the xMule project. + * + * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> + * + * 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 "Ed2kConnection.h" Array<Connection> Connection::connection; @@ -7,7 +27,9 @@ bool TcpAccept(u32 id,u32 new_id,state istatus) { assert(Connection::connection[new_id].status==ILLEGAL); bool rc; - rc=Connection::connection[id].socket.TcpAccept(Connection::connection[new_id].socket); + rc=Connection::connection[id].socket.TcpAccept( + Connection::connection[new_id].socket + ); if (!rc) return false; Connection::connection[new_id].status=istatus; return true; Index: Ed2kConnection.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Ed2kConnection.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Ed2kConnection.h 31 Oct 2003 21:00:13 -0000 1.1 +++ Ed2kConnection.h 20 Nov 2003 16:21:24 -0000 1.2 @@ -1,3 +1,23 @@ +/* + * Ed2kConnection.h. Part of the xMule project. + * + * Copyright (C) 2003 Bodo Thiesen <bo...@gm...> + * + * 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 ED2KCONNECTION_H #define ED2KCONNECTION_H @@ -107,13 +127,36 @@ } }; -inline bool ClientTcpListen (u32 id, u16 port /* 4662 */) { return TcpListen (id,port,CLIENT_TCP_LISTENING); } -inline bool ClientUdpListen (u32 id, u16 port /* 4665 */) { return UdpListen (id,port,CLIENT_UDP_LISTENING); } -inline bool ClientExtListen (u32 id, u16 port /* 4672 */) { return UdpListen (id,port,CLIENT_EXT_LISTENING); } -inline bool ServerTcpListen (u32 id, u16 port /* 4661 */) { return TcpListen (id,port,SERVER_TCP_LISTENING); } -inline bool ServerUdpListen (u32 id, u16 port /* 4666 */) { return UdpListen (id,port,SERVER_UDP_LISTENING); } -inline bool ServerTcpConnect(u32 id,u32 ip,u16 port ) { return TcpConnect(id,ip,port,SERVER_TCP_SENDING_LOGIN_REQUEST); } -inline bool ClientTcpConnect(u32 id,u32 ip,u16 port ) { return TcpConnect(id,ip,port,CLIENT_TCP_SENDING_HELLO_PACKET); } -inline bool ClientTcpAccept (u32 id,u32 new_id ) { return TcpAccept (id,new_id,CLIENT_TCP_WAITING_FOR_HELLO_PACKET); } +inline bool ClientTcpListen (u32 id, u16 port /* 4662 */) { + return TcpListen (id,port,CLIENT_TCP_LISTENING); +} + +inline bool ClientUdpListen (u32 id, u16 port /* 4665 */) { + return UdpListen (id,port,CLIENT_UDP_LISTENING); +} + +inline bool ClientExtListen (u32 id, u16 port /* 4672 */) { + return UdpListen (id,port,CLIENT_EXT_LISTENING); +} + +inline bool ServerTcpListen (u32 id, u16 port /* 4661 */) { + return TcpListen (id,port,SERVER_TCP_LISTENING); +} + +inline bool ServerUdpListen (u32 id, u16 port /* 4666 */) { + return UdpListen (id,port,SERVER_UDP_LISTENING); +} + +inline bool ServerTcpConnect(u32 id,u32 ip,u16 port ) { + return TcpConnect(id,ip,port,SERVER_TCP_SENDING_LOGIN_REQUEST); +} + +inline bool ClientTcpConnect(u32 id,u32 ip,u16 port ) { + return TcpConnect(id,ip,port,CLIENT_TCP_SENDING_HELLO_PACKET); +} + +inline bool ClientTcpAccept (u32 id,u32 new_id ) { + return TcpAccept (id,new_id,CLIENT_TCP_WAITING_FOR_HELLO_PACKET); +} #endif // #ifndef ED2KCONNECTION_H Index: Ed2kPacket.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Ed2kPacket.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Ed2kPacket.cpp 12 Oct 2003 20:59:46 -0000 1.1 +++ Ed2kPacket.cpp 20 Nov 2003 16:21:24 -0000 1.2 @@ -20,7 +20,7 @@ #include "Ed2kPacket.h" -#define LOGINREQUEST 0x01 // mlDonkey adds a DWORD with content: 'MLDK' // <DWORD>tagcount<TAG>tag[tagcount] // <BYTE>magic=0x10 +#define LOGINREQUEST 0x01 // mlDonkey adds DWORD with content: 'MLDK' #define REJECT 0x05 #define GETSERVERLIST 0x14 #define OFFERFILES 0x15 @@ -40,14 +40,14 @@ #define SERVERIDENT 0x41 #define FOUNDSOURCES 0x42 #define USERS_LIST 0x43 -#define QUERY_CHATS 0x1D // (deprecated not supported by server any longer) -#define CHAT_MESSAGE 0x1E // (deprecated not supported by server any longer) -#define JOIN_ROOM 0x1F // (deprecated not supported by server any longer) -#define CHAT_ROOM_REQUEST 0x39 // (deprecated not supported by server any longer) -#define CHAT_BROADCAST 0x3A // (deprecated not supported by server any longer) -#define CHAT_USER_JOIN 0x3B // (deprecated not supported by server any longer) -#define CHAT_USER_LEAVE 0x3C // (deprecated not supported by server any longer) -#define CHAT_USER 0x3D // (deprecated not supported by server any longer) +#define QUERY_CHATS 0x1D // (this +#define CHAT_MESSAGE 0x1E // opcodes +#define JOIN_ROOM 0x1F // are +#define CHAT_ROOM_REQUEST 0x39 // deprecated +#define CHAT_BROADCAST 0x3A // and not +#define CHAT_USER_JOIN 0x3B // supported +#define CHAT_USER_LEAVE 0x3C // by servers +#define CHAT_USER 0x3D // any longer) #define GLOBSERVSTATREQ 0x96 #define GLOBSERVSTATRES 0x97 #define GLOBSEARCHREQUEST 0x98 @@ -62,11 +62,11 @@ #define UNKNOWN2 0xA4 #define HELLO 0x01 #define SENDINGPART 0x46 -#define REQUESTPARTS 0x47 // "<HASH>file_hash<DWORD>start[3]<DWORD>end[3]" +#define REQUESTPARTS 0x47 #define FILEREQANSNOFIL 0x48 #define END_OF_DOWNLOAD 0x49 #define ASKSHAREDFILES 0x4A -#define ASKSHAREDFILESANSWER 0x4B // ? "<DWORD>file_count{<HASH>file<TAG>name}file[file_count]" }, +#define ASKSHAREDFILESANSWER 0x4B // ? "<DWORD>file_count{<HASH>file<TAG>name}file[file_count]" }, #define HELLOANSWER 0x4c #define CHANGE_CLIENT_ID 0x4D #define MESSAGE 0x4E @@ -98,15 +98,17 @@ #define REASKACK 0x91 #define FILENOTFOUND 0x92 #define QUEUEFULL 0x93 -#define VERIFYUPSREQ 0x71 // (never used) */ -#define VERIFYUPSANSWER 0x72 // (never used) */ -#define UDPVERIFYUPREQ 0x73 // (never used) */ +#define VERIFYUPSREQ 0x71 // (never used) +#define VERIFYUPSANSWER 0x72 // (never used) +#define UDPVERIFYUPREQ 0x73 // (never used) #define UDPVERIFYUPA 0x74 // (never used) static u8 buf[1024]; static int ofs; -// LOGINREQUEST "<HASH>user_hash<IPPORT>client_address=0,0<DWORD>tagcount<TAG>tag[tagcount]<IPPORT>server_address<DWORD>*software_id=1262767181" +// LOGINREQUEST "<HASH>user_hash<IPPORT>client_address=0,0 +// <DWORD>tagcount<TAG>tag[tagcount]<IPPORT>server_address +// <DWORD>*software_id=1262767181" void Ed2kPacket::BuildLoginRequest3Packet( hash user,ipport client,/* dword 3, */ u8 id1,const char * string, @@ -143,7 +145,8 @@ SetData(0xe3,GETSERVERLIST,ofs,buf); } -//OFFERFILES "<DWORD>file_count{<HASH>hash<IPPORT>source<TAG>name}file[file_count]" +// OFFERFILES "<DWORD>file_count +// {<HASH>hash<IPPORT>source<TAG>name}file[file_count]" /* void BuildOfferFilesPacket(u32 file_count,) { ofs=0; @@ -173,7 +176,9 @@ // SERVERLIST "<BYTE>server_count<IPPORT>server[server_count]" -// SEARCHRESULT "<DWORD>num_results{<HASH>hash<IPPORT>ipport<DWORD>tag_count<TAG>tag[tag_count]}user[num_results]<DWORD>unknown1<DWORD>unknown2" +// SEARCHRESULT "<DWORD>num_results{<HASH>hash<IPPORT>ipport +// <DWORD>tag_count<TAG>tag[tag_count]}user[num_results] +// <DWORD>unknown1<DWORD>unknown2" // SERVERSTATUS "<DWORD>user_count<DWORD>file_count" @@ -185,11 +190,14 @@ // IDCHANGE "<DWORD>new_id" -// SERVERIDENT "<HASH>server_hash<IPPORT>server_address<DWORD>tag_count<TAG>tag[tag_count]" +// SERVERIDENT "<HASH>server_hash<IPPORT>server_address +// <DWORD>tag_count<TAG>tag[tag_count]" -// FOUNDSOURCES "<HASH>file_hash<BYTE>source_count<IPPORT>source_address[source_count]" +// FOUNDSOURCES "<HASH>file_hash +// <BYTE>source_count<IPPORT>source_address[source_count]" -// USERS_LIST "<DWORD>user_count{<HASH>hash<IPPORT>address<TAG>name}user[user_count]" +// USERS_LIST "<DWORD>user_count +// {<HASH>hash<IPPORT>address<TAG>name}user[user_count]" // QUERY_CHATS "DEPRECATED" @@ -211,11 +219,13 @@ // GLOBSERVSTATRES "<DWORD>user_count<DWORD>file_count<DWORD>*max_users" -// GLOBSERVSTATRES "<WORD>unknown1<WORD>unknown2<DWORD>user_count<DWORD>file_count<DWORD>*max_users" +// GLOBSERVSTATRES "<WORD>unknown1<WORD>unknown2<DWORD>user_count +// <DWORD>file_count<DWORD>*max_users" // // GLOBSEARCHREQUEST "<Search query>" -// GLOBSEARCHRESULT "<HASH>hash<IPPORT>dummy<DWORD>tag_count<TAG>tag[tag_count]" +// GLOBSEARCHRESULT "<HASH>hash<IPPORT>dummy +// <DWORD>tag_count<TAG>tag[tag_count]" // GLOBGETSOURCES "<HASH>file_hash" @@ -233,7 +243,8 @@ // // UNKNOWN2 "" -// HELLO "<BYTE>magic=0x10<HASH>user_hash<IPPORT>address<DWORD>tagcount<TAG>tag[tagcount]<IPPORT>server_address" +// HELLO "<BYTE>magic=0x10<HASH>user_hash<IPPORT>address +// <DWORD>tagcount<TAG>tag[tagcount]<IPPORT>server_address" void Ed2kPacket::BuildHello3Packet( u8 magic,hash user,ipport client,/* dword 3, */ u8 id1,const char * string, @@ -260,7 +271,9 @@ // SENDINGPART "<HASH>file_hash<RANGE>range<BYTE>data[range]" -// REQUESTPARTS "<HASH>file_hash<DWORD>part_1_start<DWORD>part_2_start<DWORD>part_3_start<DWORD>part_1_end<DWORD>part_2_end<DWORD>part_3_end" +// REQUESTPARTS "<HASH>file_hash +// <DWORD>part_1_start<DWORD>part_2_start<DWORD>part_3_start +// <DWORD>part_1_end<DWORD>part_2_end<DWORD>part_3_end" // FILEREQANSNOFIL "<HASH>file_hash" @@ -268,9 +281,11 @@ // ASKSHAREDFILES "" -// ASKSHAREDFILESANSWER "<DWORD>file_count{<IPPORT>address<TAG>name}file[file_count]" +// ASKSHAREDFILESANSWER "<DWORD>file_count +// {<IPPORT>address<TAG>name}file[file_count]" -// HELLOANSWER "<HASH>user_hash<IPPORT>user<DWORD>tagcount<TAG>tag[tagcount]<IPPORT>server" +// HELLOANSWER "<HASH>user_hash<IPPORT>user +// <DWORD>tagcount<TAG>tag[tagcount]<IPPORT>server" // CHANGE_CLIENT_ID "<DWORD>old_id<DWORD>new_id" @@ -290,7 +305,8 @@ SetData(0xe3,0x51,ofs,buf); } -// HASHSETANSWER "<HASH>file_hash<WORD>chunk_count<HASH>chunk_hash[chunk_count]" +// HASHSETANSWER "<HASH>file_hash<WORD>chunk_count +// <HASH>chunk_hash[chunk_count]" // STARTUPLOADREQ "<HASH>*file_hash" @@ -302,7 +318,8 @@ // FILEREQUEST "<HASH>file_hash<BITMAP>*chunks<WORD>*unknown" -// FILEREQANSWER "<HASH>file_hash<WORD>filename_len<CHAR>filename[filename_len]" +// FILEREQANSWER "<HASH>file_hash +// <WORD>filename_len<CHAR>filename[filename_len]" // CHANGE_SLOT "<HASH>file_hash" @@ -318,9 +335,11 @@ // ANSWERSHAREDDENIED "" -// EMULEINFO "<BYTE>client_version<BYTE>protocol_version<DWORD>tagcount<TAG>tag[tagcount]" +// EMULEINFO "<BYTE>client_version<BYTE>protocol_version +// <DWORD>tagcount<TAG>tag[tagcount]" -// EMULEINFOANSWER "<BYTE>client_version<BYTE>protocol_version<DWORD>tagcount<TAG>tag[tagcount]" +// EMULEINFOANSWER "<BYTE>client_version<BYTE>protocol_version +// <DWORD>tagcount<TAG>tag[tagcount]" // COMPRESSEDPART "<HASH>file_hash<RANGE>range<BYTE>cdata[range]" @@ -330,7 +349,8 @@ // REQUESTSOURCES "<HASH>file_hash" -// ANSWERSOURCES "<HASH>file_hash<WORD>num_sources{<IPPORT>server<IPPORT>client}source[num_sources]" +// ANSWERSOURCES "<HASH>file_hash<WORD>num_sources +// {<IPPORT>server<IPPORT>client}source[num_sources]" // REASKFILEPING "<HASH>file_hash" Index: Ed2kPacket.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Ed2kPacket.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Ed2kPacket.h 29 Sep 2003 22:06:21 -0000 1.3 +++ Ed2kPacket.h 20 Nov 2003 16:21:24 -0000 1.4 @@ -37,22 +37,26 @@ private: Addr Address; u8 Protocol; // 0xc5, 0xd4 or 0xe3 - u8 Opcode; // Ie. 0x01 for Hello Packet + u8 Opcode; // E.g. 0x01 for Hello Packet u32 Size; // Size of the eDonkey Packet (excluding the Opcode) - u8 * Buffer; // Pointer to the data for the eDonkey Packet (excluding the Opcode) + u8 * Buffer; // Pointer to data for Packet (excluding the Opcode) enum {} empty; public: // We will do all sanity checks in this class :-) /* - Ed2kPacket(u32 ip,u16 port,u8 protocol,u8 opcode,u32 size,u8 * data,bool tcp) + Ed2kPacket( + u32 ip,u16 port,u8 protocol,u8 opcode, + u32 size,u8 * data,bool tcp + ) : Packet(ip,port) { Address.SetIP(ip); Address.SetPort(port); Valid=false; SetData(protocol,opcode,size,data,tcp); } - Ed2kPacket(u8 protocol,u8 opcode,u32 size,u8 * data,bool tcp) : Packet() { + Ed2kPacket(u8 protocol,u8 opcode,u32 size,u8 * data,bool tcp) + : Packet() { SetIP(INADDR_ANY); Address.SetPort(0); Valid=false; SetData(protocol,opcode,size,data,tcp); Index: Ed2kSocket.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Ed2kSocket.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Ed2kSocket.cpp 29 Sep 2003 22:06:21 -0000 1.3 +++ Ed2kSocket.cpp 20 Nov 2003 16:21:24 -0000 1.4 @@ -94,7 +94,7 @@ Packet p; while ((sock.ReceivePacket(p))) { - if ((p.GetSize())) { // Can we ever receive a packet with size=0? + if (p.GetSize()) { // Can we ever receive a packet with size=0? in_list.push_back(p); in_SumPacketSizes+=p.GetSize(); } @@ -112,7 +112,11 @@ for (i=0,pi=in_list.begin();i<5;++pi) { ptr =pi->GetPtr()+tpo; - size=pi->GetSize()-tpo; // Packes of size 0 are already discarded in Ed2kSocket::LowLevelReceive(). + size=pi->GetSize()-tpo; + /* + * Packes of size 0 are already discarded in + * Ed2kSocket::LowLevelReceive(). + */ do { packet_header[i]=*ptr++; @@ -128,9 +132,13 @@ |((u32)packet_header[4])<<24 ; - if (in_Ed2kPacketSize>0x7fffffff) - return; // FIXME: throw an exception, close the socket etc. ... - + if (in_Ed2kPacketSize>0x7fffffff) { + return; + /* + * FIXME: throw an exception, close the socket, let + * the computer explode etc. ... + */ + } } } @@ -143,11 +151,17 @@ } CheckPacketHeader(sps); - if (in_SumPacketSizes<5 || in_Ed2kPacketSize+5>in_SumPacketSizes) + if (in_SumPacketSizes<5 || in_Ed2kPacketSize+5>in_SumPacketSizes) { return false; + } - if (in_Ed2kPacketSize>0x7fffffff) - return false; // FIXME: Remove this as soon as this case is handled in Ed2kSocket::CheckPacketHeader() + if (in_Ed2kPacketSize>0x7fffffff) { + return false; + /* + * FIXME: Remove this as soon as this case is handled in + * Ed2kSocket::CheckPacketHeader(). + */ + } u8 * data=new u8[in_Ed2kPacketSize+5]; u32 pos=0; Index: MultiLevelBitmap.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/MultiLevelBitmap.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- MultiLevelBitmap.cpp 3 Sep 2003 15:58:15 -0000 1.4 +++ MultiLevelBitmap.cpp 20 Nov 2003 16:21:24 -0000 1.5 @@ -19,7 +19,12 @@ */ #define MULTILEVELBITMAP_SIZES_POW_2_ON_AUTOERLARGE -#define MULTILEVELBITMAP_ERLARGEFACTOR 3.41 // Only used #ifndef MULTILEVELBITMAP_SIZES_POW_2_ON_AUTOERLARGE +#define MULTILEVELBITMAP_ERLARGEFACTOR 3.41 + +/* + * MULTILEVELBITMAP_ERLARGEFACTOR is only used, if + * MULTILEVELBITMAP_SIZES_POW_2_ON_AUTOERLARGE is not defined + */ #include "MultiLevelBitmap.h" @@ -133,7 +138,9 @@ #ifdef MULTILEVELBITMAP_SIZES_POW_2_ON_AUTOERLARGE if (!Erlarge(num_entries?num_entries*2:1)) return ULONG_MAX; #else // #ifdef MULTILEVELBITMAP_SIZES_POW_2_ON_AUTOERLARGE - if (!Erlarge(num_entries?(unsigned long)(MULTILEVELBITMAP_ERLARGEFACTOR*num_entries):1)) return ULONG_MAX; + if (!Erlarge(num_entries?(unsigned long)( + MULTILEVELBITMAP_ERLARGEFACTOR*num_entries + ):1)) return ULONG_MAX; #endif // #ifdef MULTILEVELBITMAP_SIZES_POW_2_ON_AUTOERLARGE, #else } @@ -250,7 +257,8 @@ ); for (unsigned long j=0;j<one;++j) { if (!bitmap[num_levels-i+1][j]) { - bitmap[num_levels-i][j/CB]^=(1<<(j%CB)); + bitmap[num_levels-i][j/CB]^= + (1<<(j%CB)); } } } Index: ParseClass.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/ParseClass.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ParseClass.cpp 20 Nov 2003 14:41:11 -0000 1.6 +++ ParseClass.cpp 20 Nov 2003 16:21:24 -0000 1.7 @@ -88,7 +88,9 @@ // printf("parseError(\"%s\",...)\n",expr); - delimiter=parse_string(&expr,"[.",LettersUnderscore,LettersNumbersUnderscore,&var); + delimiter=parse_string( + &expr,"[.",LettersUnderscore,LettersNumbersUnderscore,&var + ); for (*ps=type;*ps;*ps=(*ps)->next) { if (!strcmp((*ps)->varname,var)) @@ -115,7 +117,10 @@ if ((!((*ps)->flags&PF_ARRAY0)) == (*array=delimiter=='[')) { if (delimiter=='[') { - fprintf(stderr,"Array subscript given on something not an array\n"); + fprintf(stderr, + "Array subscript given on something " + "not an array\n" + ); } else { fprintf(stderr,"Array subscript expected\n"); } @@ -133,11 +138,15 @@ if (debug_now) printf("*index=%i\n",*index); expr=var; if (*(expr-1)=='[') { - fprintf(stderr,"Array subscript is empty or invalid\n"); + fprintf(stderr, + "Array subscript is empty or invalid\n" + ); return true; } if (*expr++!=']') { - fprintf(stderr,"Array subscript is not followed by a ']'\n"); + fprintf(stderr, + "Array subscript is not followed by a ']'\n" + ); return true; } delimiter=*expr++; @@ -149,7 +158,10 @@ // if (debug_now) printf("*expr='%c'\n",*expr); if (delimiter=='.') { - fprintf(stderr,"Struct subscript given on something not an struct\n"); + fprintf(stderr, + "Struct subscript given on something " + "not an struct\n" + ); } else { fprintf(stderr,"Struct subscript expected\n"); } @@ -210,8 +222,9 @@ offset=size-sizeof(ParseClass*); for (i=n;i<nume;++i) { - for (p=0;p<numPCs;++p) { - (*(ParseClass**)(data+size*i+offset))[p].~ParseClass(); + ParseClass * PC=(*(ParseClass**)(data+size*i+offset)); + for (p=0;p<numPCs;++p,++PC) { + PC->~ParseClass(); } free(*(ParseClass**)(data+size*i+offset)); } @@ -242,7 +255,8 @@ *(ParseClass**)(data+size*i+offset)=PCp; for (ps=type;ps;ps=ps->next) { - if (ps->flags&PF_ARRAY0 || ps->type_id==STRUCT) { + if (ps->flags&PF_ARRAY0 + || ps->type_id==STRUCT) { assert(ps->referer_id<numPCs); if (ps->type_id==STRUCT) { new (PCp+ps->referer_id) @@ -269,265 +283,339 @@ int PClevel; -size_t ParseClass::IncrementalRead(const u8 * buffer,size_t buffsize,size_t n) { - const struct parsestruct * ps; - size_t i,done; - u8 * dataptr; +size_t ParseClass::IncrementalReadArray( + const u8 * buffer,size_t buffsize +) { + size_t n=nume; + size_t done; struct tag * tag; -/* - printf( - "%*s>> IncrementalRead(buffer=%p,buffsize=%u,n=%u)\n" - ,8*PClevel++,"",buffer,(int)buffsize,(int)n - ); -*/ - - if (nume!=n) { - Resize(n); - } - done=0; - if (!IsArray()) { - dataptr=data; - -/* - printf("size=%i, offset of %s=%i\n",size,type->next->varname,type->next->offset); -*/ - for (i=0;i<n;++i) { -/* - printf("i=%i\n",i); -*/ - for (ps=type;ps;ps=ps->next) { - if (ps->flags&PF_ARRAY0 || ps->type_id==STRUCT) { - u32 num; - + if (type->type_id==BITMAP) { + fprintf( + stderr, + "%s:%s:%i: Fatal: ParseClass::IncrementalRead is " + "not implemented for type->type_id==BITMAP.\n" + ,__FILE__,__FUNCTION__,__LINE__ + ); + exit(1); + } + if (type->type_id==TAG) { /* - if (!strcmp(ps->counter_var->varname,"num_tags")) { - Get(num,0,ps->counter_var->varname); - printf("num[0]=%i, ",num); - Get(num,1,ps->counter_var->varname); - printf("num[1]=%i, ",num); - Get(num,2,ps->counter_var->varname); - printf("num[2]=%i, ",num); - printf("i=%i\n",i); - } + printf("size=%i, type[TAG].len=%i\n",size,::type[TAG].len); + printf("TAG\n"); */ - - /* - * XXX: Struct without array is not defined, so - * I don't take care about that special case - * here at all. - */ - /* - if (parent) { - parent->Get(num,i,ps->counter_var->varname); - } else { - */ - Get(num,i,ps->counter_var->varname); - //} - + + for ( + tag=reinterpret_cast<struct tag *>(data); + n; + ++tag,--n + ) { /* - printf("num=%i\n",num); + printf("tag"); fflush(stdout); */ - - if (num) { - size_t call_done; - - ParseClass * PC=*(ParseClass**) - (data+size*(i+1)-sizeof(ParseClass*)*numPCs); - PC+=ps->referer_id; + if (buffsize<1) return (size_t)-1; + tag->type=*buffer; + buffer +=1; + buffsize-=1; + done +=1; /* - printf(">>PC->IncrementalRead(buffer,buffsize,num);\n"); + printf(" (0x%02x)",(unsigned)tag->type); + fflush(stdout); */ - call_done=PC->IncrementalRead(buffer,buffsize,num); + + if (buffsize<2) return (size_t)-1; + tag->id_len=ltoh16(*(u16*)buffer); + buffer +=2; + buffsize-=2; + done +=2; + + if (buffsize<tag->id_len) return (size_t)-1; + if (!tag->id_len) { + fprintf( + stderr, + "%s:%s:%i: Fatal: ParseClass::" + "IncrementalRead: Type id len = 0.\n" + ,__FILE__,__FUNCTION__,__LINE__ + ); + exit(1); + } else if (tag->id_len==1) { + tag->id.number=*buffer; + buffer +=1; + buffsize-=1; + done +=1; /* - printf("<<PC->IncrementalRead(buffer,buffsize,num);\n"); + printf(" id=0x%02x: ",tag->id.number); + fflush(stdout); */ - if (call_done==(size_t)-1) return call_done; - buffer +=call_done; - buffsize-=call_done; - done +=call_done; + } else { + tag->id.string=new u8[tag->id_len+1]; + memcpy(tag->id.string,buffer,tag->id_len); + tag->id.string[tag->id_len]=0; + buffer +=tag->id_len; + buffsize-=tag->id_len; + done +=tag->id_len; /* - printf("*buffer=0x%02x, ps->next=%p\n",(unsigned)*buffer,(void*)ps->next); + printf(" id=%s: ",tag->id.string); + fflush(stdout); */ + } + + switch (tag->type) { + case 2: // STRING + if (buffsize<2) return (size_t)-1; + tag->value.string.length= + ltoh16(*(u16*)buffer); + buffer +=2; + buffsize-=2; + done +=2; + + if (buffsize<tag->value.string.length) { + return (size_t)-1; } - } else { - ParseClass * PC; - u32 val; - unsigned j; - bool scalar; + tag->value.string.content= + new u8[tag->value.string.length+1]; + memcpy( + tag->value.string.content, + buffer,tag->value.string.length + ); + tag->value.string.content[ + tag->value.string.length + ]=0; + buffer +=tag->value.string.length; + buffsize-=tag->value.string.length; + done +=tag->value.string.length; /* - printf("."); fflush(stdout); + printf( + "\"%s\"\n" + ,tag->value.string.content + ); */ - if (buffsize<ps->size) return (size_t)-1; - switch (ps->type_id) { - case BYTE: scalar=true; * dataptr =val= * buffer ; break; - case WORD: scalar=true; *(u16*) dataptr =val=ltoh16(*(u16*) buffer) ; break; - case DWORD: scalar=true; *(u32*) dataptr =val=ltoh32(*(u32*) buffer) ; break; - case IPPORT: scalar=false; *(u32*) dataptr = lton32(*(u32*) buffer ); - *(u16*)(dataptr+4)= ltoh16(*(u16*)(buffer+4)); break; - default: - scalar=false; - memcpy(dataptr,buffer,ps->size); - } + break; + + case 3: + if (buffsize<4) return (size_t)-1; + tag->value.dword=ltoh32(*(u32*)buffer); + buffer +=4; + buffsize-=4; + done +=4; - if (ps->num_referer) { - if (!scalar) { - fprintf( - stderr, - "%s:%s:%i: Fatal: ParseClass::IncrementalRead: \n" - "Type != BYTE, WORD, DWORD was used as array size subscript.\n" - "type=%i (%s)\n", - __FILE__,__FUNCTION__,__LINE__,ps->type_id,::type[ps->type_id].type_name - ); - exit(1); - } - - PC=*(ParseClass**)(data+size*(i+1)-sizeof(ParseClass*)*numPCs); - for (j=0;j<ps->num_referer;++j,++PC) { - PC->Resize(val); - } - } +/* + printf("%u\n",tag->value.dword); +*/ - dataptr +=ps->size; - buffer +=ps->size; - buffsize-=ps->size; - done +=ps->size; - } + break; + + default: + fprintf( + stderr, + "%s:%s:%i: Fatal: ParseClass::" + "IncrementalRead: Unknown tag " + "type %i\n" + ,__FILE__,__FUNCTION__,__LINE__ + ,tag->type + ); + exit(1); } - dataptr+=numPCs*sizeof(ParseClass*); - } - } else { // if (IsArray()) - if (type->type_id==BITMAP) { - fprintf( - stderr, - "%s:%s:%i: Fatal: ParseClass::IncrementalRead is not implemented for type->type_id==BITMAP.\n" - ,__FILE__,__FUNCTION__,__LINE__ - ); - exit(1); } - if (type->type_id==TAG) { /* - printf("size=%i, type[TAG].len=%i\n",size,::type[TAG].len); - printf("TAG\n"); + printf("GAT (0x%02x)\n",(unsigned)*buffer); */ - - for ( - tag=reinterpret_cast<struct tag *>(data); - n; - ++tag,--n - ) { + } else { /* - printf("tag"); fflush(stdout); + printf("size=%i,n=%i,type->size=%i\n",size,n,type->size); */ - if (buffsize<1) return (size_t)-1; - tag->type=*buffer; - buffer +=1; - buffsize-=1; - done +=1; + if (buffsize<size*n) return (size_t)-1; + memcpy(data,buffer,size*n); + buffer +=size*n; + buffsize-=size*n; + done +=size*n; + } + + return done; +} + +void PrintScalarErrorMsgAndExit(const struct parsestruct * ps) { + fprintf( + stderr, + "%s:%s:%i: Fatal: ParseClass::IncrementalRead: \n" + "Type != BYTE, WORD, DWORD was used as array size subscript.\n" + "type=%i (%s)\n", + __FILE__,__FUNCTION__,__LINE__,ps->type_id,::type[ps->type_id].type_name + ); + exit(1); +} + +ParseClass * ParseClass::FirstParseClassPointer(int idx) { + return *(ParseClass**)(data+size*(idx+1)-sizeof(ParseClass*)*numPCs); +} + +size_t ParseClass::IncrementalReadNonArray( + const u8 * buffer,size_t buffsize +) { + size_t n=nume; + const struct parsestruct * ps; + size_t i,done; + u8 * dataptr; + + done=0; + + dataptr=data; + /* - printf(" (0x%02x)",(unsigned)tag->type); fflush(stdout); + printf( + "size=%i, offset of %s=%i\n" + ,size,type->next->varname,type->next->offset + ); */ + for (i=0;i<n;++i) { +/* + printf("i=%i\n",i); +*/ + for (ps=type;ps;ps=ps->next) { + if (ps->flags&PF_ARRAY0 + || ps->type_id==STRUCT) { + u32 num; - if (buffsize<2) return (size_t)-1; - tag->id_len=ltoh16(*(u16*)buffer); - buffer +=2; - buffsize-=2; - done +=2; - - if (buffsize<tag->id_len) return (size_t)-1; - if (!tag->id_len) { - fprintf( - stderr, - "%s:%s:%i: Fatal: ParseClass::IncrementalRead: Type id len = 0.\n" - ,__FILE__,__FUNCTION__,__LINE__ - ); - exit(1); - } else if (tag->id_len==1) { - tag->id.number=*buffer; - buffer +=1; - buffsize-=1; - done +=1; /* - printf(" id=0x%02x: ",tag->id.number); fflush(stdout); + if (!strcmp( + ps->counter_var->varname, + "num_tags" + )) { + Get(num,0,ps->counter_var->varname); + printf("num[0]=%i, ",num); + Get(num,1,ps->counter_var->varname); + printf("num[1]=%i, ",num); + Get(num,2,ps->counter_var->varname); + printf("num[2]=%i, ",num); + printf("i=%i\n",i); + } */ + + /* + * XXX: Struct without array is not + * defined, so I don't take care + * about that special case here at + * all. + */ + /* + if (parent) { + parent->Get( + num,i, + ps->counter_var->varname + ); } else { - tag->id.string=new u8[tag->id_len+1]; - memcpy(tag->id.string,buffer,tag->id_len); - tag->id.string[tag->id_len]=0; - buffer +=tag->id_len; - buffsize-=tag->id_len; - done +=tag->id_len; + */ + Get(num,i,ps->counter_var->varname); + //} + /* - printf(" id=%s: ",tag->id.string); fflush(stdout); + printf("num=%i\n",num); */ - } - switch (tag->type) { - case 2: // STRING - if (buffsize<2) return (size_t)-1; - tag->value.string.length=ltoh16(*(u16*)buffer); - buffer +=2; - buffsize-=2; - done +=2; - - if (buffsize<tag->value.string.length) return (size_t)-1; - tag->value.string.content=new u8[tag->value.string.length+1]; - memcpy(tag->value.string.content,buffer,tag->value.string.length); - tag->value.string.content[tag->value.string.length]=0; - buffer +=tag->value.string.length; - buffsize-=tag->value.string.length; - done +=tag->value.string.length; - + if (num) { + size_t call_done; + + ParseClass * PC; + + PC=FirstParseClassPointer(i); + PC+=ps->referer_id; + + call_done=PC->IncrementalRead( + buffer,buffsize,num + ); + if (call_done==(size_t)-1) { + return call_done; + } + buffer +=call_done; + buffsize-=call_done; + done +=call_done; /* - printf("\"%s\"\n",tag->value.string.content); + printf( + "*buffer=0x%02x, " + "ps->next=%p\n" + ,(unsigned)*buffer + ,(void*)ps->next + ); */ - - break; - - case 3: - if (buffsize<4) return (size_t)-1; - tag->value.dword=ltoh32(*(u32*)buffer); - buffer +=4; - buffsize-=4; - done +=4; - + } + } else { + ParseClass * PC; + u32 val; + unsigned j; + bool scalar; + /* - printf("%u\n",tag->value.dword); + printf("."); fflush(stdout); */ - - break; - + if (buffsize<ps->size) { + return (size_t)-1; + } + + switch (ps->type_id) { + case BYTE: scalar=true; * dataptr =val= * buffer ; break; + case WORD: scalar=true; *(u16*) dataptr =val=ltoh16(*(u16*) buffer) ; break; + case DWORD: scalar=true; *(u32*) dataptr =val=ltoh32(*(u32*) buffer) ; break; + case IPPORT: scalar=false; *(u32*) dataptr = lton32(*(u32*) buffer ); + *(u16*)(dataptr+4)= ltoh16(*(u16*)(buffer+4)); break; default: - fprintf( - stderr, - "%s:%s:%i: Fatal: ParseClass::IncrementalRead: Unknown tag type %i\n" - ,__FILE__,__FUNCTION__,__LINE__,tag->type - ); - exit(1); + scalar=false; + memcpy(dataptr,buffer,ps->size); } + + /* + * FIXME: This test should be moved to + * parse-ed2k.c, because if doesn't + * need to be repeated for each + * received packet. + */ + if (ps->num_referer) { + if (!scalar) { + PrintScalarErrorMsgAndExit(ps); + } + + PC=FirstParseClassPointer(i); + for (j=0;j<ps->num_referer;++j,++PC) { + PC->Resize(val); + } + } + + dataptr +=ps->size; + buffer +=ps->size; + buffsize-=ps->size; + done +=ps->size; } -/* - printf("GAT (0x%02x)\n",(unsigned)*buffer); -*/ - } else { -/* - printf("size=%i,n=%i,type->size=%i\n",size,n,type->size); -*/ - if (buffsize<size*n) return (size_t)-1; - memcpy(data,buffer,size*n); - buffer +=size*n; - buffsize-=size*n; - done +=size*n; } - } // if (IsArray()), else + dataptr+=numPCs*sizeof(ParseClass*); + } return done; } +size_t ParseClass::IncrementalRead( + const u8 * buffer,size_t buffsize,size_t n +) { +/* + printf( + "%*s>> IncrementalRead(buffer=%p,buffsize=%u,n=%u)\n" + ,8*PClevel++,"",buffer,(int)buffsize,(int)n + ); +*/ + + if (nume!=n) { + Resize(n); + } + + if (IsArray()) { + return IncrementalReadArray(buffer,buffsize); + } else { + return IncrementalReadNonArray(buffer,buffsize); + } +} + bool ParseClass::Read(const u8 * buffer,size_t buffsize) { size_t done; @@ -539,8 +627,10 @@ if (done!=buffsize) { fprintf( stderr, - "%s:%s:%i: Warning: done!=buffsize: buffsize=%u, done=%u.\n" - ,__FILE__,__FUNCTION__,__LINE__,(unsigned)buffsize,(unsigned)done + "%s:%s:%i: Warning: done!=buffsize: buffsize=%u, " + "done=%u.\n" + ,__FILE__,__FUNCTION__,__LINE__ + ,(unsigned)buffsize,(unsigned)done ); } @@ -550,6 +640,7 @@ bool ParseClass::Read(FILE * file) { /* * ISO/IEC 9899:1999 (E) §7.19.9.2(3) + * * For a binary stream, the new position, measured in characters from * the beginning of the file, is obtained by adding offset to the * position specified by whence. The specified position is the Index: ParseClass.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/ParseClass.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ParseClass.h 20 Nov 2003 14:41:11 -0000 1.6 +++ ParseClass.h 20 Nov 2003 16:21:24 -0000 1.7 @@ -45,10 +45,11 @@ #define ISARRAY(x) true /* - * Ok, bedboi, the format string of the server.met is: - * - * "<BYTE>magic=0xe0<DWORD>num_servers{<IPPORT>ipport<DWORD>num_tags<TAG>tag[num_tags]}server[num_servers]" - * + +The format string of the server.met is: + +"<BYTE>magic=0xe0<DWORD>num_servers +{<IPPORT>ipport<DWORD>num_tags<TAG>tag[num_tags]}server[num_servers]" An example entry is: @@ -84,18 +85,23 @@ server_met.Dword ("server[0].tag[1][0x86]" ) -> 0x692daa3b server_met.Dword ("server[%i].tag[%i][%i]", 0,1,0x87 ) -> 0x00001b5f -The first string is simply a format string, and the rest are the va_args. No problem -> vsprintf ... +UPDATE: Now the method is called GetF(var &,const char * fmt,...) and the + ".ip" or ".port" of tje 4. and 5. example must be specified as part of + the fmt string. Another Method, SetF is available, too. -The constructor will get a parsestruct pointer as returned by packet_description -(or an equivalent function). Than you must set up (maybe simply copy) data -structures to store values. A call of Read will follow, there you must read the -data with types as instructed by parsestruct to your internal structures in a -way, that you can easily look them up via the member functions Bitmap, Char, -Byte, ... +The first string is simply a format string, and the rest are the va_args. No +problem -> vsprintf ... + +The constructor will get a parsestruct pointer as returned by +packet_description (or an equivalent function). Than you must set up (maybe +simply copy) data structures to store values. A call of Read will follow, there +you must read the data with types as instructed by parsestruct to your internal +structures in a way, that you can easily look them up via the member functions +Bitmap, Char, Byte, ... The sizes if the data types are stored in the type array (see parse-ed2k.h), -Bitmap and String are special ones, because they are not fixed length. And there -is a data type "TAG" which you must handle in the Read and Write methods. +Bitmap and String are special ones, because they are not fixed length. And +there is a data type "TAG" which you must handle in the Read and Write methods. BTW: This will be a major function (as it will be used on receiving and sending of every packet even as on reading and writing of every .met file, thus it @@ -117,16 +123,20 @@ public: struct panic {}; private: - const struct parsestruct * type; // (Sub)type of this data - unsigned char * data; // Pointer to the actual data - size_t size; // Num chars per element - size_t numPCs; // Num ParseClasses at the end of each element - size_t nume; // Num elements (for array) + const struct parsestruct * type; // (Sub)type of this data + unsigned char * data; // Pointer to the actual data + size_t size; // Num chars per element + size_t numPCs; // Num PCs @ the end of each element + size_t nume; // Num elements (for array) const class ParseClass * parent; - ParseClass(const class ParseClass &); // No copy-constructor, plz - ParseClass & operator =(const class ParseClass &); // And not assignment operator, too - ParseClass(); // And no default constructor (which would mean a typeless data structure) + /* + * I want no copy-constructors, assignment operators and no + * default constructor (which would mean a typeless data structure) + */ + ParseClass(const class ParseClass &); + ParseClass & operator =(const class ParseClass &); + ParseClass(); /* * Calculate the size of this element according to current type. @@ -174,13 +184,22 @@ size_t IncrementalRead(const u8 * buffer,size_t buffsize,size_t n); /* + * Helpers for IncrementalRead. + */ + ParseClass * FirstParseClassPointer(int idx); + size_t IncrementalReadNonArray(const u8 * buffer,size_t buffsize); + size_t IncrementalReadArray(const u8 * buffer,size_t buffsize); + + /* * Get * * Read the variable specified by expr at index index and return it in * var. This may throw a ParseClass::panic, if the string in expr is * not valid or if index is too big. */ - template <class T> void Get(T & var,size_t index,const char * expr) const { + template <class T> void Get( + T & var,size_t index,const char * expr + ) const { const char * subexpr; const struct parsestruct * ps; bool array; @@ -191,7 +210,8 @@ || parseError(expr,&subexpr,&ps,&next_index,&array,&struc)) { fprintf( stderr, - "%s:%s:%i: expr=\"%s\" is invalid or index=%i is out of range\n", + "%s:%s:%i: expr=\"%s\" is invalid or index=%i " + "is out of range\n", __FILE__,__FUNCTION__,__LINE__,expr,index ); abort(); @@ -213,23 +233,32 @@ ParseClass * PC=*(ParseClass**) (data+size*(index+1)-sizeof(ParseClass*)); /* - printf("PC=%p, ",reinterpret_cast<void*>(PC)); fflush(stdout); + printf("PC=%p, ",reinterpret_cast<void*>(PC)); + fflush(stdout); */ if (struc) { /* printf("struct\n"); - printf(">>PC[ps->referer_id].Get(var,next_index,subexpr)\n"); + printf( + ">>PC[ps->referer_id]." + "Get(var,next_index,subexpr)\n" + ); */ PC[ps->referer_id].Get(var,next_index,subexpr); /* - printf("<<PC[ps->referer_id].Get(var,next_index,subexpr)\n"); + printf( + "<<PC[ps->referer_id]." + "Get(var,next_index,subexpr)\n" + ); */ } else { /* printf("!struct\n"); printf( - "PC->data=%p, PC->size=%i, next_index=%i, PC->nume=%i\n" - ,PC->data, PC->size, next_index, PC->nume + "PC->data=%p, PC->size=%i, " + "next_index=%i, PC->nume=%i\n" + ,PC->data,PC->size, + next_index,PC->nume ); */ var=*(T*)(PC->data+PC->size*next_index); @@ -248,7 +277,9 @@ * This may throw a ParseClass::panic, if the string in expr is not * valid or if index is too big. */ - template <class T> void Set(const T & var,size_t index,const char * expr) { + template <class T> void Set( + const T & var,size_t index,const char * expr + ) { const char * subexpr; const struct parsestruct * ps; bool array; @@ -260,7 +291,8 @@ || parseError(expr,&subexpr,&ps,&next_index,&array,&struc)) { fprintf( stderr, - "%s:%s:%i: expr=\"%s\" is invalid or index=%i is out of range\n", + "%s:%s:%i: expr=\"%s\" is invalid or index=%i " + "is out of range\n", __FILE__,__FUNCTION__,__LINE__,expr,index ); abort(); @@ -282,14 +314,18 @@ PC[ps->referer_id].Set(var,next_index,subexpr); } else { *(T*)(PC->data+PC->size*next_index)=var; - /* An array MUST NOT be uses as subscript, so we don't - * need to take care about that here. + /* + * An array MUST NOT be used as subscript, so + * we don't need to take care about that here. */ } } } - void Construct(const class ParseClass * pc,const struct parsestruct * ps,size_t n=1) { + void Construct( + const class ParseClass * pc, + const struct parsestruct * ps,size_t n=1 + ) { assert(n>0); type=ps; @@ -302,7 +338,10 @@ Resize(n); } - ParseClass(const class ParseClass * pc,const struct parsestruct * ps,size_t n=1) { + ParseClass( + const class ParseClass * pc, + const struct parsestruct * ps,size_t n=1 + ) { Construct(pc,ps,n); } @@ -319,7 +358,8 @@ bool Read(FILE * file); bool Read(const char * filename); - bool Write(u8 * * buffer,size_t * buffsize) const; // *buffsize=(size_t)-1 means error + // *buffsize=(size_t)-1 means error + bool Write(u8 * * buffer,size_t * buffsize) const; bool Write(FILE * file) const; bool Write(const char * filename) const; @@ -336,9 +376,12 @@ /-* Only valid for tags: *-/ char * String(const char * varname_fmt,...) PRINTF_FORMAT; -// float Float (const char * varname_fmt,...) PRINTF_FORMAT; <--- Float not implemented at all + // Float is not implemented at all +// float Float (const char * varname_fmt,...) PRINTF_FORMAT; */ - template <class T> void GetF(T & var,const char * fmt,...) const /* PRINTF_FORMAT(2,3) */ { + template <class T> void GetF( + T & var,const char * fmt,... + ) const /* PRINTF_FORMAT(2,3) */ { char * expr; va_list ap; @@ -359,7 +402,9 @@ free(expr); } - template <class T> void SetF(const T & var,const char * fmt,...) /* PRINTF_FORMAT(2,3) */ { + template <class T> void SetF( + const T & var,const char * fmt,... + ) /* PRINTF_FORMAT(2,3) */ { char * expr; va_list ap; Index: Socket.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Socket.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- Socket.cpp 8 Sep 2003 00:31:54 -0000 1.9 +++ Socket.cpp 20 Nov 2003 16:21:24 -0000 1.10 @@ -49,7 +49,11 @@ struct protoent * prent; prent=getprotobyname("tcp"); if (!prent) { - fprintf(stderr,"WARNING: getprotobyname(\"%s\") failed: %s\n",TCP?"tcp":"udp",strerror(errno)); + fprintf(stderr, + "WARNING: getprotobyname(\"%s\") " + "failed: %s\n" + ,TCP?"tcp":"udp",strerror(errno) + ); return false; } tcp_protocol=prent->p_proto; @@ -60,7 +64,11 @@ struct protoent * prent; prent=getprotobyname("udp"); if (!prent) { - fprintf(stderr,"WARNING: getprotobyname(\"%s\") failed: %s\n",TCP?"tcp":"udp",strerror(errno)); + fprintf(stderr, + "WARNING: getprotobyname(\"%s\") " + "failed: %s\n" + ,TCP?"tcp":"udp",strerror(errno) + ); return false; } udp_protocol=prent->p_proto; @@ -68,9 +76,16 @@ } } - fd=socket(AF_INET,TCP?SOCK_STREAM:SOCK_DGRAM,TCP?tcp_protocol:udp_protocol); + fd=socket( + AF_INET, + TCP?SOCK_STREAM:SOCK_DGRAM, + TCP?tcp_protocol:udp_protocol + ); if (fd<0) { - fprintf(stderr,"WARNING: socket() failed: %s\n",strerror(errno)); + fprintf(stderr, + "WARNING: socket() failed: %s\n" + ,strerror(errno) + ); return false; } @@ -87,13 +102,19 @@ Addr addr(INADDR_ANY,port); if (bind(fd,addr.GetSa(),sizeof(sockaddr_in))) { - fprintf(stderr,"WARNING: bind() to port %u filed: %s\n",(unsigned)addr.GetPort(),strerror(errno)); + fprintf( + stderr,"WARNING: bind() to port %u filed: %s\n" + ,(unsigned)addr.GetPort(),strerror(errno) + ); return false; } state=TCP_BOUND; if (listen(fd,LISTEN_QUEUE_SIZE)) { - fprintf(stderr,"WARNING: listen() on port %u faied: %s\n",(unsigned)addr.GetPort(),strerror(errno)); + fprintf( + stderr,"WARNING: listen() on port %u faied: %s\n" + ,(unsigned)addr.GetPort(),strerror(errno) + ); return false; } state=TCP_LISTENING; @@ -110,7 +131,12 @@ if (get_errno()==EINPROGRESS) { state=TCP_CONNECTING; } else { - fprintf(stderr,"WARNING: connect() to ip:port %lu:%u failed: %s\n",(unsigned long)addr.GetIP(),(unsigned)addr.GetPort(),strerror(errno)); + fprintf( + stderr,"WARNING: connect() to ip:port %lu:%u " + "failed: %s\n" + ,(unsigned long)addr.GetIP() + ,(unsigned)addr.GetPort(),strerror(errno) + ); Close(); return false; } @@ -137,7 +163,10 @@ Addr addr(INADDR_ANY,port); if (bind(fd,addr.GetSa(),sizeof(sockaddr_in))) { - fprintf(stderr,"WARNING: bind on port %u filed: %s\n",addr.GetPort(),strerror(errno)); + fprintf( + stderr,"WARNING: bind on port %u filed: %s\n" + ,addr.GetPort(),strerror(errno) + ); return false; } state=UDP_BOUND; @@ -160,7 +189,9 @@ } if (optval) { errno=optval; - fprintf(stderr,"getsockopt-optval=%i: %s\n",optval,strerror(optval)); + fprintf(stderr, + "getsockopt-optval=%i: %s\n",optval,strerror(optval) + ); state=TCP_ERROR; return false; } @@ -171,8 +202,12 @@ } bool Socket::SendPacket(const Packet & packet) { - if (state!=TCP_CONNECTED && state!=TCP_CONNECTING && state!=UDP_OPEN && state!=UDP_BOUND) { - fprintf(stderr,"WARNING: state!=TCP_CONNECTED,TCP_CONNECTING,UDP_OPEN and UDP_BOUND in Socket::SendPacket()\n"); + if (state!=TCP_CONNECTED && state!=TCP_CONNECTING + && state!=UDP_OPEN && state!=UDP_BOUND) { + fprintf(stderr, + "WARNING: state!=TCP_CONNECTED,TCP_CONNECTING," + "UDP_OPEN and UDP_BOUND in Socket::SendPacket()\n" + ); errno=EINVAL; return false; } @@ -189,13 +224,20 @@ // return write(fd,packet.GetPtr(),packet.GetSize())>=0; return send(fd,packet.GetPtr(),packet.GetSize(),0)>=0; } else { - return sendto(fd,packet.GetPtr(),packet.GetSize(),0,packet.GetAddr().GetSa(),sizeof(sockaddr_in))>=0; + return sendto( + fd,packet.GetPtr(),packet.GetSize(),0, + packet.GetAddr().GetSa(),sizeof(sockaddr_in) + )>=0; } } bool Socket::ReceivePacket(Packet & packet) { - if (state!=TCP_CONNECTED && state!=TCP_CONNECTING && state!=UDP_BOUND) { - fprintf(stderr,"WARNING: state!=TCP_CONNECTED,TCP_CONNECTING and UDP_BOUND in Socket::ReceivePacket()\n"); + if (state!=TCP_CONNECTED && state!=TCP_CONNECTING + && state!=UDP_BOUND) { + fprintf(stderr, + "WARNING: state!=TCP_CONNECTED,TCP_CONNECTING " + "and UDP_BOUND in Socket::ReceivePacket()\n" + ); errno=EINVAL; return false; } @@ -235,10 +277,11 @@ ); if (rc_recvfrom<0 || rc_recvfrom>=65536) { - // Our buffer was not big enough. Note: We cannot recover the - // data - it's lost. But that's no problem, because UDP is not - // a save transmission method - the sender must expect some - // packets to be lost. So simply return here. + // Our buffer was not big enough. Note: We cannot + // recover the data - it's lost. But that's no problem, + // because UDP is not a save transmission method - the + // sender must expect some packets to be lost. So + // simply return here. return false; } @@ -257,7 +300,10 @@ socklen_t salen=sizeof(sa); if (state!=TCP_LISTENING || peer.state!=CLOSED) { - fprintf(stderr,"WARNING: this->state!=TCP_LISTENING or peer.state!=CLOSED in Socket::Accept()\n"); + fprintf(stderr, + "WARNING: this->state!=TCP_LISTENING or " + "peer.state!=CLOSED in Socket::Accept()\n" + ); if (state!=TCP_LISTENING) { errno=EINVAL; return false; @@ -287,7 +333,10 @@ state=CLOSED; if (close(fd)<0) { - fprintf(stderr,"WARNING: Couldn't close file descriptor: %s\n",strerror(errno)); + fprintf(stderr, + "WARNING: Couldn't close file descriptor: %s\n" + ,strerror(errno) + ); return false; } Index: Socket.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/Socket.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Socket.h 29 Sep 2003 22:06:21 -0000 1.8 +++ Socket.h 20 Nov 2003 16:21:24 -0000 1.9 @@ -42,14 +42,14 @@ int fd; Addr Address; enum State { - CLOSED, // Socket::Socket(),Socket::Close() - TCP_SOCKET,UDP_SOCKET, // Socket::CreateSocket() - TCP_BOUND,TCP_LISTENING, // Socket::TcpListen() - TCP_CONNECTING, // Socket::TcpConnect() - TCP_CONNECTED, // Socket::TcpConnect(),Socket::StillConnecting - TCP_ERROR, - UDP_OPEN, // Socket::UdpSender() - UDP_BOUND, // Socket::UdpBind() + CLOSED, // Socket(),Close() + TCP_SOCKET,UDP_SOCKET, // CreateSocket() + TCP_BOUND,TCP_LISTENING, // TcpListen() + TCP_CONNECTING, // TcpConnect() + TCP_CONNECTED, // TcpConnect(),StillConnecting() + TCP_ERROR, // + UDP_OPEN, // UdpSender() + UDP_BOUND, // UdpBind() ___dummy___ } state; Index: debug.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/debug.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- debug.h 8 Sep 2003 00:31:54 -0000 1.4 +++ debug.h 20 Nov 2003 16:21:24 -0000 1.5 @@ -43,7 +43,11 @@ inited_stddbg=1;\ init_stddbg();\ }\ - PRINTER("%*sEntering %s\n",level++,"",__FUNCTION__);\ + PRINTER(\ + "%*sEntering %s\n",\ + level++,"",\ + __FUNCTION__\ + );\ } while(0) # define LEAVE() do {\ @@ -51,7 +55,11 @@ inited_stddbg=1;\ init_stddbg();\ }\ - PRINTER("%*sLeaving %s\n",--level,"",__FUNCTION__);\ + PRINTER(\ + "%*sLeaving %s\n",\ + --level,"",\ + __FUNCTION__\ + );\ return;\ } while(0) @@ -60,21 +68,37 @@ inited_stddbg=1;\ init_stddbg();\ }\ - PRINTER("%*sReturning %s\n",--level,"",__FUNCTION__);\ + PRINTER(\ + "%*sReturning %s\n",\ + --level,"",\ + __FUNCTION__\ + );\ return RV;\ } while(0) # else // #ifdef HAVE_BTLINUXLIBRARY # define ENTER() do {\ - PRINTER("%*sEntering %s\n",level++,"",__FUNCTION__);\ + PRINTER(\ + "%*sEntering %s\n",\ + level++,"",\ + __FUNCTION__\ + );\ } while(0) # define LEAVE() do {\ - PRINTER("%*sLeaving %s\n",--level,"",__FUNCTION__);\ + PRINTER(\ + "%*sLeaving %s\n",\ + --level,"",\ + __FUNCTION__\ + );\ return;\ } while(0) # define RETURN(RV) do {\ - PRINTER("%*sReturning %s\n",--level,"",__FUNCTION__);\ + PRINTER(\ + "%*sReturning %s\n",\ + --level,"",\ + __FUNCTION__\ + );\ return RV;\ } while(0) # endif // #ifdef HAVE_BTLINUXLIBRARY Index: osdep.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/osdep.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- osdep.cpp 5 Sep 2003 15:01:00 -0000 1.6 +++ osdep.cpp 20 Nov 2003 16:21:24 -0000 1.7 @@ -38,7 +38,11 @@ void nonblocking(int fd) { int arg = 1; if (ioctl(fd,FIONBIO,&arg)) { - fprintf(stderr,"WARNING: Couldn't set socket to non-blocking mode: %s\n",strerror(errno)); + fprintf(stderr, + "WARNING: Couldn't set socket " + "to non-blocking mode: %s\n", + strerror(errno) + ); } } @@ -56,7 +60,11 @@ int flags; if ((flags=fcntl(fd,F_GETFL))<0 || fcntl(fd,F_SETFL,flags|O_NONBLOCK)<0) { - fprintf(stderr,"WARNING: Couldn't set socket to non-blocking mode: %s\n",strerror(errno)); + fprintf(stderr, + "WARNING: Couldn't set socket " + "to non-blocking mode: %s\n", + strerror(errno) + ); } } Index: osdep.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/osdep.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- osdep.h 5 Sep 2003 15:01:00 -0000 1.8 +++ osdep.h 20 Nov 2003 16:21:24 -0000 1.9 @@ -75,7 +75,9 @@ static inline char * intp2charp(int * x) { return (char*)x; } static inline char * voidp2charp(void * x) { return (char*)x; } -static inline const char * cvoidp2ccharp(const void * x) { return (const char*)x; } +static inline const char * cvoidp2ccharp(const void * x) { + return (const char*)x; +} typedef uint32_t in_addr_t; Index: parse-ed2k.c =================================================================== RCS file: /cvsroot/sharedaemon/core/src/parse-ed2k.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- parse-ed2k.c 20 Nov 2003 14:43:01 -0000 1.11 +++ parse-ed2k.c 20 Nov 2003 16:21:24 -0000 1.12 @@ -22,6 +22,13 @@ * #define PRINT_PARSESTRUCT if you want to see the output * of print_parsestruct and some[TM] other outputs. */ +// #define PRINT_PARSESTRUCT + +/* + * Keep this not too low as this directly limit the number of elements of a + * packet: + */ +#define MAX_NUM_VARS 32 #include "parse-ed2k.h" @@ -72,6 +79,8 @@ /* * Tag type specification: * "<BYTE>type<BYTE>idlen<CHAR>id[idlen]<CONDITIONAL[type]>(2:<WORD>strlen<CHAR>string... [truncated message content] |
From: <bo...@us...> - 2003-11-20 15:29:11
|
Update of /cvsroot/sharedaemon/core/src In directory sc8-pr-cvs1:/tmp/cvs-serv29047 Modified Files: test.cpp Log Message: Fixed some variable declaration bugs which were introduced by splitting the function Serve. Index: test.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/test.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- test.cpp 20 Nov 2003 14:44:06 -0000 1.23 +++ test.cpp 20 Nov 2003 15:28:28 -0000 1.24 @@ -652,6 +652,9 @@ } void Client_Tcp_Sending_Hello_Packet(u32 id) { + bool rc; + Ed2kPacket p; + p.BuildHello3Packet( 0x10,userhash,ipport(MY_IP,DEFAULT_CLIENTPORT), 0x01,"bothie tests his xMule v2 core", @@ -693,6 +696,9 @@ } void Server_Tcp_Sending_Login_Request(u32 id) { + bool rc; + Ed2kPacket p; + p.BuildLoginRequest3Packet( userhash,ipport(0,DEFAULT_CLIENTPORT), // <HASH>user<IPPORT>client<DWORD>tagcount 0x01,"bothie tests his xMule v2 core", // <TAG>non-unique user name @@ -806,6 +812,9 @@ } bool Client_Tcp_Waiting_For_Hello_Answer(u32 id) { + bool rc; + Ed2kPacket p; + rc=Connection::GetSocket(id).ReceivePacket(p); if (!rc) { if (get_errno()!=SOCKET_EWOULDBLOCK) { @@ -825,6 +834,9 @@ } bool Client_Tcp_Waiting_For_Hello_Packet(u32 id) { + bool rc; + Ed2kPacket p; + rc=Connection::GetSocket(id).ReceivePacket(p); if (!rc) { if (get_errno()!=SOCKET_EWOULDBLOCK) { @@ -848,7 +860,6 @@ static u32 nc=0xffffffff; bool rc; - Ed2kPacket p; if (id==nc || Connection::IsFree(id)) { return; |
From: <bo...@us...> - 2003-11-20 14:44:49
|
Update of /cvsroot/sharedaemon/core/src In directory sc8-pr-cvs1:/tmp/cvs-serv20594 Modified Files: test.cpp Log Message: Splitted down the big switch in function Serve to many small functions, one for each case. Index: test.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/test.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- test.cpp 31 Oct 2003 21:00:13 -0000 1.22 +++ test.cpp 20 Nov 2003 14:44:06 -0000 1.23 @@ -440,6 +440,7 @@ #include <signal.h> #define _GLIBCPP_DEPRECATED // We want std::vector::push_back(void)! #include <vector> +#include <map> hash userhash={{'x','M','u','l','e',0x0e,'2','0','0','3','0','8','2','6',0x6f,'2'}}; /* @@ -638,9 +639,215 @@ // class Connection Connection::empty; int num_connected=0; +std::map<std::string,ParseClass *> PClist; + +void Log(char * msg) { + struct tm * t; + time_t tmp; + + tmp=time(NULL); + t=localtime(&tmp); + + printf("%04u-%02u-%02u %02u:%02u'%02u: %s",1900+t->tm_year,t->tm_mon,t->tm_mday,t->tm_hour,t->tm_min,t->tm_sec,msg); +} + +void Client_Tcp_Sending_Hello_Packet(u32 id) { + p.BuildHello3Packet( + 0x10,userhash,ipport(MY_IP,DEFAULT_CLIENTPORT), + 0x01,"bothie tests his xMule v2 core", + 0x11,60, + 0x0f,DEFAULT_CLIENTPORT, + ipport(MY_IP,DEFAULT_SERVERPORT) + ); + printf( + "Sending packet (id=%lu; ip:port=%lu:%u. Protocol=0x%02x, Opcode=0x%02x, Size=0x%08x\n", + (long unsigned)id,(long unsigned)Connection::GetSocket(id).GetIP(), + (unsigned)Connection::GetSocket(id).GetPort(),p.GetProtocol(), + p.GetOpcode(),(int)p.GetSize() + ); + printf("%s:%i: \n",__FILE__,__LINE__); HexDump(p.GetPtr(),p.GetSize(),true); + rc=Connection::GetSocket(id).EnqueuePacket(p); + if (!rc) { + if (get_errno()!=SOCKET_EWOULDBLOCK) { + Connection::GetSocket(id).Close(); + Connection::SetStatus(id,ILLEGAL); + Connection::Free(id); + return; + } + } + Connection::SetStatus(id,CLIENT_TCP_WAITING_FOR_HELLO_ANSWER); + + p.BuildHashsetRequestPacket(filehash); + printf( + "Sending packet (id=%lu; ip:port=%lu:%u. Protocol=0x%02x, Opcode=0x%02x, Size=0x%08x\n", + (long unsigned)id,(long unsigned)Connection::GetSocket(id).GetIP(), + (unsigned)Connection::GetSocket(id).GetPort(),p.GetProtocol(), + p.GetOpcode(),(int)p.GetSize() + ); + printf("%s:%i: \n",__FILE__,__LINE__); HexDump(p.GetPtr(),p.GetSize(),true); + rc=Connection::GetSocket(id).EnqueuePacket(p); + if (!rc) { + printf("error sending hashset request.\n"); + } + rc=true; +} + +void Server_Tcp_Sending_Login_Request(u32 id) { + p.BuildLoginRequest3Packet( + userhash,ipport(0,DEFAULT_CLIENTPORT), // <HASH>user<IPPORT>client<DWORD>tagcount + 0x01,"bothie tests his xMule v2 core", // <TAG>non-unique user name + 0x11,60, // <TAG>version + 0x0f,DEFAULT_CLIENTPORT, // <TAG>port + ipport(0,DEFAULT_SERVERPORT) // <IPPORT>server_address + ); + // i+=mkdword (r+i,'MLDK'); // <DWORD>*software_id + printf( + "Sending packet (id=%lu; ip:port=%lu:%u. Protocol=0x%02x, Opcode=0x%02x, Size=0x%08x\n", + (long unsigned)id,(long unsigned)Connection::GetSocket(id).GetIP(), + (unsigned)Connection::GetSocket(id).GetPort(),p.GetProtocol(), + p.GetOpcode(),(int)p.GetSize() + ); + printf("%s:%i: \n",__FILE__,__LINE__); HexDump(p.GetPtr(),p.GetSize(),true); + rc=Connection::GetSocket(id).EnqueuePacket(p); + if (!rc) { + if (get_errno()!=SOCKET_EWOULDBLOCK) { + Connection::GetSocket(id).Close(); + Connection::SetStatus(id,ILLEGAL); + Connection::Free(id); + return; + } + } + Connection::SetStatus(id,SERVER_TCP_WAITING_FOR_LOGIN_ANSWER); + rc=true; +} + +bool Server_Tcp_Waiting_For_Login_Answer(u32 id) { + bool rc; + Ed2kPacket p; + const parsestruct * ps; + ParseClass * PC; + + // We need 0x40 (IDCHANGE) here. + // Additionally we can already accept here: + // * 0x34 (SERVERSTATUS) + // * 0x41 (SERVERIDENT) + // * 0x38 (SERVERMESSAGE) + rc=Connection::GetSocket(id).ReceivePacket(p); + if (!rc) { + if (get_errno()!=SOCKET_EWOULDBLOCK) { + Connection::GetSocket(id).Close(); + Connection::SetStatus(id,ILLEGAL); + Connection::Free(id); + } + return false; + } + + printf( + "Received packet (id=%lu; ip:port=%lu:%u. Protocol=0x%02x, Opcode=0x%02x, Size=0x%08x\n", + (long unsigned)id,(long unsigned)p.GetIP(),(unsigned)p.GetPort(),p.GetProtocol(),p.GetOpcode(),(int)p.GetSize() + ); + printf("%s:%i: \n",__FILE__,__LINE__); HexDump(p.GetPtr(),p.GetSize(),false); + + if (!packet_description(p.GetProtocol(),p.GetOpcode(),&ps,NULL)) { + fprintf( + stderr + ,"%s:%i: FATAL: Couldn't find ps for packet 0x%02x,0x%02x.\n" + ,__FILE__,__LINE__,p.GetProtocol(),p.GetOpcode() + ); + Connection::GetSocket(id).Close(); + Connection::SetStatus(id,ILLEGAL); + Connection::Free(id); + return false; + } + + switch ((u16)p.GetProtocol()*0x100+p.GetOpcode()) { + case 0xe338: // Servermessage + u16 msglen; + char * msg; + + if (!PClist["e338"]) { + PClist["e338"]=new ParseClass(ps); + } + PC=PClist["e338"]; + printf("Servermessage:\n"); + // Log Message. + PC->Read(p.GetPtr(),p.GetSize()); + PC->Get(msglen,"message_len"); + printf("msglen=%u\n",msglen); + msg=new char[msglen]; + for (u16 i=0;i<msglen;++i) { + PC->GetF(msg[i],"message[%u]",i); + } + Log(msg); + break; + + case 0xe334: // Serverstatus + printf("Serverstatus:\n"); + printf("%s:%i: \n",__FILE__,__LINE__); HexDump(p.GetPtr(),p.GetSize(),false); + // Update ServerMet + // Schedule ServerMet to write back to disk + break; + + case 0xe340: // IDchange + printf("IDchange:\n"); + printf("%s:%i: \n",__FILE__,__LINE__); HexDump(p.GetPtr(),p.GetSize(),false); + // ??? + break; + + case 0xe341: // ServerIdent + printf("ServerIdent:\n"); + printf("%s:%i: \n",__FILE__,__LINE__); HexDump(p.GetPtr(),p.GetSize(),false); + // Update ServerMet + // Schedule ServerMet to write back to disk + break; + } + + return true; +} + +bool Client_Tcp_Waiting_For_Hello_Answer(u32 id) { + rc=Connection::GetSocket(id).ReceivePacket(p); + if (!rc) { + if (get_errno()!=SOCKET_EWOULDBLOCK) { + Connection::GetSocket(id).Close(); + Connection::SetStatus(id,ILLEGAL); + Connection::Free(id); + } + return false; + } + printf( + "Received packet (id=%lu; ip:port=%lu:%u. Protocol=0x%02x, Opcode=0x%02x, Size=0x%08x\n", + (long unsigned)id,(long unsigned)p.GetIP(),(unsigned)p.GetPort(),p.GetProtocol(),p.GetOpcode(),(int)p.GetSize() + ); + printf("%s:%i: \n",__FILE__,__LINE__); HexDump(p.GetPtr(),p.GetSize(),false); + + return true; +} + +bool Client_Tcp_Waiting_For_Hello_Packet(u32 id) { + rc=Connection::GetSocket(id).ReceivePacket(p); + if (!rc) { + if (get_errno()!=SOCKET_EWOULDBLOCK) { + Connection::GetSocket(id).Close(); + Connection::SetStatus(id,ILLEGAL); + Connection::Free(id); + } + return false; + } + printf( + "Received packet (id=%lu; ip:port=%lu:%u. Protocol=0x%02x, Opcode=0x%02x, Size=0x%08x\n", + (long unsigned)id,(long unsigned)p.GetIP(),(unsigned)p.GetPort(),p.GetProtocol(),p.GetOpcode(),(int)p.GetSize() + ); + printf("%s:%i: \n",__FILE__,__LINE__); HexDump(p.GetPtr(),p.GetSize(),false); + + return true; +} + void Serve(u32 id) { - bool rc,again; + bool again; static u32 nc=0xffffffff; + + bool rc; Ed2kPacket p; if (id==nc || Connection::IsFree(id)) { @@ -649,7 +856,8 @@ rc=Connection::GetSocket(id).SendPackets(1024); if (!rc) { - if (get_errno()!=SOCKET_EWOULDBLOCK && get_errno()!=SOCKET_EINPROGRESS) { + if (get_errno()!=SOCKET_EWOULDBLOCK + && get_errno()!=SOCKET_EINPROGRESS) { Connection::GetSocket(id).Close(); Connection::SetStatus(id,ILLEGAL); Connection::Free(id); @@ -684,138 +892,33 @@ rc=true; break; case CLIENT_TCP_SENDING_HELLO_PACKET: { - p.BuildHello3Packet( - 0x10,userhash,ipport(MY_IP,DEFAULT_CLIENTPORT), - 0x01,"bothie tests his xMule v2 core", - 0x11,60, - 0x0f,DEFAULT_CLIENTPORT, - ipport(MY_IP,DEFAULT_SERVERPORT) - ); - printf( - "Sending packet (id=%lu; ip:port=%lu:%u. Protocol=0x%02x, Opcode=0x%02x, Size=0x%08x\n", - (long unsigned)id,(long unsigned)Connection::GetSocket(id).GetIP(), - (unsigned)Connection::GetSocket(id).GetPort(),p.GetProtocol(), - p.GetOpcode(),(int)p.GetSize() - ); - HexDump(p.GetPtr(),p.GetSize(),true); - rc=Connection::GetSocket(id).EnqueuePacket(p); - if (!rc) { - if (get_errno()!=SOCKET_EWOULDBLOCK) { - Connection::GetSocket(id).Close(); - Connection::SetStatus(id,ILLEGAL); - Connection::Free(id); - break; - } - } - Connection::SetStatus(id,CLIENT_TCP_WAITING_FOR_HELLO_ANSWER); + Client_Tcp_Sending_Hello_Packet(id); - p.BuildHashsetRequestPacket(filehash); - printf( - "Sending packet (id=%lu; ip:port=%lu:%u. Protocol=0x%02x, Opcode=0x%02x, Size=0x%08x\n", - (long unsigned)id,(long unsigned)Connection::GetSocket(id).GetIP(), - (unsigned)Connection::GetSocket(id).GetPort(),p.GetProtocol(), - p.GetOpcode(),(int)p.GetSize() - ); - HexDump(p.GetPtr(),p.GetSize(),true); - rc=Connection::GetSocket(id).EnqueuePacket(p); - if (!rc) { - printf("error sending hashset request.\n"); - } - rc=true; break; } case SERVER_TCP_SENDING_LOGIN_REQUEST: { - p.BuildLoginRequest3Packet( - userhash,ipport(0,DEFAULT_CLIENTPORT), // <HASH>user<IPPORT>client<DWORD>tagcount - 0x01,"bothie tests his xMule v2 core", // <TAG>non-unique user name - 0x11,60, // <TAG>version - 0x0f,DEFAULT_CLIENTPORT, // <TAG>port - ipport(0,DEFAULT_SERVERPORT) // <IPPORT>server_address - ); - // i+=mkdword (r+i,'MLDK'); // <DWORD>*software_id - printf( - "Sending packet (id=%lu; ip:port=%lu:%u. Protocol=0x%02x, Opcode=0x%02x, Size=0x%08x\n", - (long unsigned)id,(long unsigned)Connection::GetSocket(id).GetIP(), - (unsigned)Connection::GetSocket(id).GetPort(),p.GetProtocol(), - p.GetOpcode(),(int)p.GetSize() - ); - HexDump(p.GetPtr(),p.GetSize(),true); - rc=Connection::GetSocket(id).EnqueuePacket(p); - if (!rc) { - if (get_errno()!=SOCKET_EWOULDBLOCK) { - Connection::GetSocket(id).Close(); - Connection::SetStatus(id,ILLEGAL); - Connection::Free(id); - break; - } - } - Connection::SetStatus(id,SERVER_TCP_WAITING_FOR_LOGIN_ANSWER); - rc=true; + Server_Tcp_Sending_Login_Request(id); + break; } case SERVER_TCP_WAITING_FOR_LOGIN_ANSWER: { - // We need 0x41 (SERVERIDENT) and 0x40 (IDCHANGE) - // Additionally we can accept here 0x34 (SERVERSTATUS) - // and 0x38 (SERVERMESSAGE) already - rc=Connection::GetSocket(id).ReceivePacket(p); - if (!rc) { - if (get_errno()!=SOCKET_EWOULDBLOCK) { - Connection::GetSocket(id).Close(); - Connection::SetStatus(id,ILLEGAL); - Connection::Free(id); - } - break; - } - printf( - "Received packet (id=%lu; ip:port=%lu:%u. Protocol=0x%02x, Opcode=0x%02x, Size=0x%08x\n", - (long unsigned)id,(long unsigned)p.GetIP(),(unsigned)p.GetPort(),p.GetProtocol(),p.GetOpcode(),(int)p.GetSize() - ); - HexDump(p.GetPtr(),p.GetSize(),false); - again=true; + again=Server_Tcp_Waiting_For_Login_Answer(id); break; } case CLIENT_TCP_WAITING_FOR_HELLO_ANSWER: { - rc=Connection::GetSocket(id).ReceivePacket(p); - if (!rc) { - if (get_errno()!=SOCKET_EWOULDBLOCK) { - Connection::GetSocket(id).Close(); - Connection::SetStatus(id,ILLEGAL); - Connection::Free(id); - } - break; - } - printf( - "Received packet (id=%lu; ip:port=%lu:%u. Protocol=0x%02x, Opcode=0x%02x, Size=0x%08x\n", - (long unsigned)id,(long unsigned)p.GetIP(),(unsigned)p.GetPort(),p.GetProtocol(),p.GetOpcode(),(int)p.GetSize() - ); - HexDump(p.GetPtr(),p.GetSize(),false); - again=true; + again=Client_Tcp_Waiting_For_Hello_Answer(id); break; } case CLIENT_TCP_WAITING_FOR_HELLO_PACKET: - rc=Connection::GetSocket(id).ReceivePacket(p); - if (!rc) { - if (get_errno()!=SOCKET_EWOULDBLOCK) { - Connection::GetSocket(id).Close(); - Connection::SetStatus(id,ILLEGAL); - Connection::Free(id); - } - break; - } - printf( - "Received packet (id=%lu; ip:port=%lu:%u. Protocol=0x%02x, Opcode=0x%02x, Size=0x%08x\n", - (long unsigned)id,(long unsigned)p.GetIP(),(unsigned)p.GetPort(),p.GetProtocol(),p.GetOpcode(),(int)p.GetSize() - ); - HexDump(p.GetPtr(),p.GetSize(),false); - again=true; + again=Client_Tcp_Waiting_For_Hello_Packet(id); break; default: rc=false; break; - }; // for (again=true;!(again=!again);), switch (Connection::GetStatus(id)) + }; // for (again=true;!(again=!again);), switch (Conn.::GetStatus(id)) } /* // Anything went wrong: @@ -838,6 +941,43 @@ return 1; } +/* +Received packet (id=2; ip:port=0:0. Protocol=0xe3, Opcode=0x41, Size=0x0000005f +00000000 2a2a 2a2a 6998 7348 51dc ff5c 4a94 ec58 ****isHQÜ \JX +00000010 0afb 960f 3512 0200 0000 0201 0001 0f00 ..5........... +00000020 626f 7468 6965 2773 2053 6572 7665 7202 bothie's.Server. +00000030 0100 0b2a 0045 7870 6572 696d 656e 7461 ...*.Experimenta +00000040 6c20 7365 7276 6572 2062 6173 6564 2075 l.server.based.u +00000050 706f 6e20 6546 6172 6d20 7630 2e32 62 pon.eFarm.v0.2b + +Received packet (id=2; ip:port=0:0. Protocol=0xe3, Opcode=0x34, Size=0x00000008 +00000000 0100 0000 0000 0000 ........ + +Received packet (id=2; ip:port=0:0. Protocol=0xe3, Opcode=0x40, Size=0x00000004 +00000000 7f00 0001 .... + +Received packet (id=2; ip:port=0:0. Protocol=0xe3, Opcode=0x38, Size=0x0000004d +00000000 4b00 5465 7374 7365 7276 6572 2e20 506f K.Testserver..Po +00000010 7765 7265 6420 6279 2068 7474 703a 2f2f wered.by.http:// +00000020 7777 772e 6566 6172 6d2d 7072 6f6a 6563 www.efarm-projec +00000030 742e 6e65 742c 2076 6572 7369 6f6e 2030 t.net,.version.0 +00000040 2e32 6220 2870 6174 6368 6564 29 .2b.(patched) + +Received packet (id=2; ip:port=0:0. Protocol=0xe3, Opcode=0x38, Size=0x000000b9 +00000000 b700 5468 6973 2073 6572 7665 7220 7365 .This.server.se +00000010 656d 7320 746f 2068 6176 6520 7072 6f62 ems.to.have.prob +00000020 6c65 6d73 2073 6572 7669 6e67 2073 6561 lems.serving.sea +00000030 7263 6820 7265 7175 6573 7473 2e20 4927 rch.requests..I' +00000040 6d20 776f 726b 696e 6720 6f6e 2069 7421 m.working.on.it! +00000050 2050 6c65 6173 6520 636f 6e6e 6563 7420 .Please.connect. +00000060 746f 2070 6f72 7420 3436 3631 2061 6e64 to.port.4661.and +00000070 206e 6f74 2035 3636 312e 2054 6865 2073 .not.5661..The.s +00000080 6572 7665 7220 7275 6e6e 696e 6720 6174 erver.running.at +00000090 2035 3636 3120 7769 6c6c 2062 6520 7265 .5661.will.be.re +000000a0 7374 6174 6564 2065 7665 7279 2066 6577 stated.every.few +000000b0 206d 696e 7574 6573 2e .minutes. +*/ + int main(int argc,char * argv[]) { u32 serverindex; u32 ip; @@ -891,6 +1031,9 @@ rc=ClientTcpConnect(Connection::Alloc(),MY_IP,6662); printf("ClientTcpConnect(Alloc(),MY_IP,6662)=%i\n",(int)rc); + + rc=ServerTcpConnect(Connection::Alloc(),MY_IP,4661); + printf("ServerTcpConnect(Connection::Alloc(),MY_IP,4661)=%i\n",(int)rc); for (;;) { if (!--serverconnectwait) { |
From: <bo...@us...> - 2003-11-20 14:43:44
|
Update of /cvsroot/sharedaemon/core/src In directory sc8-pr-cvs1:/tmp/cvs-serv20291 Modified Files: parse-ed2k.c Log Message: Added support to get only element or string (or none of them) in packet_description Index: parse-ed2k.c =================================================================== RCS file: /cvsroot/sharedaemon/core/src/parse-ed2k.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- parse-ed2k.c 27 Oct 2003 18:20:57 -0000 1.10 +++ parse-ed2k.c 20 Nov 2003 14:43:01 -0000 1.11 @@ -1012,8 +1012,8 @@ if (!this) return false; - *element=this->element; - *string=this->name; + if (element) *element=this->element; + if (string ) *string =this->name; return true; } |
From: <bo...@us...> - 2003-11-20 14:41:55
|
Update of /cvsroot/sharedaemon/core/src In directory sc8-pr-cvs1:/tmp/cvs-serv20068 Modified Files: ParseClass.cpp ParseClass.h Log Message: Corrected constness of buffer to Read methode Index: ParseClass.cpp =================================================================== RCS file: /cvsroot/sharedaemon/core/src/ParseClass.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ParseClass.cpp 27 Oct 2003 18:20:57 -0000 1.5 +++ ParseClass.cpp 20 Nov 2003 14:41:11 -0000 1.6 @@ -269,7 +269,7 @@ int PClevel; -size_t ParseClass::IncrementalRead(u8 * buffer,size_t buffsize,size_t n) { +size_t ParseClass::IncrementalRead(const u8 * buffer,size_t buffsize,size_t n) { const struct parsestruct * ps; size_t i,done; u8 * dataptr; @@ -528,7 +528,7 @@ return done; } -bool ParseClass::Read(u8 * buffer,size_t buffsize) { +bool ParseClass::Read(const u8 * buffer,size_t buffsize) { size_t done; done=IncrementalRead(buffer,buffsize,1); @@ -539,8 +539,8 @@ if (done!=buffsize) { fprintf( stderr, - "%s:%s:%i: Warning: done!=buffsize: buffsize=%i, done=%i.\n" - ,__FILE__,__FUNCTION__,__LINE__,buffsize,done + "%s:%s:%i: Warning: done!=buffsize: buffsize=%u, done=%u.\n" + ,__FILE__,__FUNCTION__,__LINE__,(unsigned)buffsize,(unsigned)done ); } Index: ParseClass.h =================================================================== RCS file: /cvsroot/sharedaemon/core/src/ParseClass.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ParseClass.h 26 Oct 2003 17:09:37 -0000 1.5 +++ ParseClass.h 20 Nov 2003 14:41:11 -0000 1.6 @@ -171,7 +171,7 @@ /* * Helper for the Read method. */ - size_t IncrementalRead(u8 * buffer,size_t buffsize,size_t n); + size_t IncrementalRead(const u8 * buffer,size_t buffsize,size_t n); /* * Get @@ -315,7 +315,7 @@ if (data) free(data); } - bool Read(u8 * buffer,size_t buffsize); + bool Read(const u8 * buffer,size_t buffsize); bool Read(FILE * file); bool Read(const char * filename); |
From: <ma...@us...> - 2003-11-20 12:03:03
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv25499 Modified Files: SysTray.h SysTray.cpp MainDlg.cpp Log Message: Use wxHAS_TASK_BAR_ICON to detect its availablity instead of __WXMSW__. Also added dblclick functionality to taskbaricon. Index: SysTray.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SysTray.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- SysTray.h 20 Nov 2003 01:27:26 -0000 1.4 +++ SysTray.h 20 Nov 2003 12:02:20 -0000 1.5 @@ -29,10 +29,9 @@ #endif #include "defines.h" -#include "wxInterface.h" +#include "MainDlg.h" -/* TaskBarIcon class is only supported under wxMSW */ -#ifdef __WXMSW__ +#ifdef wxHAS_TASK_BAR_ICON class CSysTray: public wxTaskBarIcon { public: @@ -40,10 +39,11 @@ virtual ~CSysTray(); private: void ShowContextMenu(wxTaskBarIconEvent &event); - void HideShowGUI(wxCommandEvent &event); + void HideShowGUI(); void ChangeGUISettings(wxCommandEvent &event); void ShowHelp(wxCommandEvent &event); void Quit(wxCommandEvent &event); + void OnLButtonDClick(); DECLARE_EVENT_TABLE() }; Index: SysTray.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SysTray.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- SysTray.cpp 20 Nov 2003 01:27:26 -0000 1.8 +++ SysTray.cpp 20 Nov 2003 12:02:20 -0000 1.9 @@ -30,11 +30,11 @@ #include "SysTray.h" -/* TaskbarIcon class is only supported under wxMSW */ -#ifdef __WXMSW__ +#ifdef wxHAS_TASK_BAR_ICON BEGIN_EVENT_TABLE(CSysTray,wxTaskBarIcon) EVT_TASKBAR_RIGHT_DOWN(CSysTray::ShowContextMenu) + EVT_TASKBAR_LEFT_DCLICK(CSysTray::OnLButtonDClick) EVT_MENU(MENU_TRAY_HIDESHOW_GUI, CSysTray::HideShowGUI) EVT_MENU(MENU_TRAY_CHANGE_GUI_SETTINGS, CSysTray::ChangeGUISettings) EVT_MENU(MENU_TRAY_HELP, CSysTray::ShowHelp) @@ -74,9 +74,8 @@ /** * This method will hide or show (iconize) the main dialog. */ -void CSysTray::HideShowGUI(wxCommandEvent &event) { - bool iconized = mainframe->IsIconized(); - mainframe->Iconize(!iconized); +void CSysTray::HideShowGUI() { + mainframe->Show(!mainframe->IsShown()); } /** @@ -109,5 +108,10 @@ */ delete mainframe; } + +void CSysTray::OnLButtonDClick() { + HideShowGUI(); +} + #endif Index: MainDlg.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- MainDlg.cpp 20 Nov 2003 01:27:26 -0000 1.1 +++ MainDlg.cpp 20 Nov 2003 12:02:20 -0000 1.2 @@ -37,7 +37,7 @@ class CSharedFilesWnd *sharedfileswnd; class CMessagesWnd *messageswnd; class CStatisticsWnd *statisticswnd; -#ifdef __WXMSW__ +#ifdef wxHAS_TASK_BAR_ICON class CSysTray *systray; #endif class CStatusBar *statusbar; @@ -108,7 +108,7 @@ icon.CopyFromBitmap(img->mule); SetIcon(icon); - #ifdef __WXMSW__ + #ifdef wxHAS_TASK_BAR_ICON systray = new CSysTray(); #endif @@ -173,7 +173,7 @@ m_config->Write(wxT("/General/Start page"), m_lastbtn-1001); } - #ifdef __WXMSW__ + #ifdef wxHAS_TASK_BAR_ICON systray->RemoveIcon(); delete systray; #endif |
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv31500/src Modified Files: ColorFrameCtrl.cpp ColorFrameCtrl.h DownloadListCtrl.cpp DownloadListCtrl.h GUISettingsDlg.cpp GUISettingsDlg.h Images.cpp Images.h KnownListCtrl.cpp KnownListCtrl.h MListCtrl.cpp MListCtrl.h Makefile Makefile.b32 MessagesWnd.cpp MessagesWnd.h QueueListCtrl.cpp QueueListCtrl.h SBPanel.cpp SBPanel.h SearchListCtrl.cpp SearchListCtrl.h SearchWnd.cpp SearchWnd.h ServerListCtrl.cpp ServerListCtrl.h ServerWnd.cpp ServerWnd.h SharedFilesListCtrl.cpp SharedFilesListCtrl.h SharedFilesWnd.cpp SharedFilesWnd.h StatisticsTreeCtrl.cpp StatisticsTreeCtrl.h StatisticsWnd.cpp StatisticsWnd.h StatusBar.cpp StatusBar.h SysTray.cpp SysTray.h TransferWnd.cpp TransferWnd.h UploadListCtrl.cpp UploadListCtrl.h defines.h Added Files: MainDlg.cpp MainDlg.h wxInterface.cpp wxInterface.dev wxInterface.h wxInterface.ico wxInterface.wdr wxInterface_private.h wxInterface_private.rc wxInterface_wdr.cpp wxInterface_wdr.h Removed Files: xMuleDlg.cpp xMuleDlg.h xMuleGUI.cpp xMuleGUI.h xMuleGUI.wdr xMuleGUI_wdr.cpp xMuleGUI_wdr.h xmule2-ui-wx.dev xmule2-ui-wx.ico xmule2-ui-wx_private.h xmule2-ui-wx_private.rc Log Message: Renamed xMule* files to wxInterface*, renamed xMuleGUI class to wxInterface, xMuleDlg to CMainFrame and changed all xmule2 stuff in source to wxInterface. --- NEW FILE: MainDlg.cpp --- /* * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * 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 */ #ifdef __GNUG__ #pragma implementation "MainDlg.h" #endif // For compilers that support precompilation #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #include "MainDlg.h" /* Global classes */ class CServerWnd *serverwnd; class CTransferWnd *transferwnd; class CSearchWnd *searchwnd; class CSharedFilesWnd *sharedfileswnd; class CMessagesWnd *messageswnd; class CStatisticsWnd *statisticswnd; #ifdef __WXMSW__ class CSysTray *systray; #endif class CStatusBar *statusbar; /* * MainDlg class. The main dialog functions like Toolbar and Statusbar * stuff go in here. */ BEGIN_EVENT_TABLE(CMainDlg,wxFrame) /* Shutdown events */ EVT_CLOSE(CMainDlg::OnCloseWindow) /* Main toolbar button events */ EVT_TOOL(ID_BTN_CONNECT, CMainDlg::ConnectToAnyServer) EVT_TOOL(ID_BTN_SERVERS, CMainDlg::ShowServerWnd) EVT_TOOL(ID_BTN_TRANSFER, CMainDlg::ShowTransferWnd) EVT_TOOL(ID_BTN_SEARCH, CMainDlg::ShowSearchWnd) EVT_TOOL(ID_BTN_SHARED_FILES, CMainDlg::ShowSharedFilesWnd) EVT_TOOL(ID_BTN_MESSAGES, CMainDlg::ShowMessagesWnd) EVT_TOOL(ID_BTN_STATISTICS, CMainDlg::ShowStatisticsWnd) EVT_TOOL(ID_BTN_GUISETTINGS, CMainDlg::ShowGUISettingsDlg) /* Menubar events */ EVT_MENU(ID_FILE_CONNECT, CMainDlg::ConnectToAnyServer) EVT_MENU(ID_FILE_EXIT, CMainDlg::OnCloseWindow) EVT_MENU(ID_EDIT_GUI_SETTINGS, CMainDlg::ShowGUISettingsDlg) EVT_MENU(ID_VIEW_SERVERS, CMainDlg::ShowServerWnd) EVT_MENU(ID_VIEW_TRANSFER, CMainDlg::ShowTransferWnd) EVT_MENU(ID_VIEW_SEARCH, CMainDlg::ShowSearchWnd) EVT_MENU(ID_VIEW_SHARED_FILES, CMainDlg::ShowSharedFilesWnd) EVT_MENU(ID_VIEW_MESSAGES, CMainDlg::ShowMessagesWnd) EVT_MENU(ID_VIEW_STATISTICS, CMainDlg::ShowStatisticsWnd) END_EVENT_TABLE() /* * Main dialog constructor. Creates toolbar on the top, statusbar on the * bottom and loads the sub-dialogs (serverwnd, searchwnd etc). */ CMainDlg::CMainDlg( wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style, wxLocale &l ) : wxFrame( parent, id, title, position, size, style ), m_locale(l) { int height, width, posx, posy; start_up = true; /* Create toolbar */ show_tool = true; m_config->Read(wxT("/General/Show toolbar"), &show_tool, true); if (show_tool) { CreateMyToolBar(); } /* Create status bar */ statusbar = new CStatusBar(this); SetStatusBar(statusbar); /* Create menu bar */ bool show_menu; m_config->Read(wxT("/General/Show menubar"), &show_menu, false); if (show_menu) { CreateMenuBar(); } /* Set application icon */ wxIcon icon; icon.CopyFromBitmap(img->mule); SetIcon(icon); #ifdef __WXMSW__ systray = new CSysTray(); #endif /* This adds a new sizer in the frame to make switching pages easier. */ m_mainsizer = ContentSizer(this, true); /** * Read position and size settings, and apply them before * loading dialog pages. */ m_config->Read(wxT("Frame/Height"), &height, 600); m_config->Read(wxT("Frame/Width"), &width, 800); SetSize(width, height); /** * If X and Y positions were not found in config object, we will not * use default values, but instead center the dialog (20,20 values * caused problems on OS X, better to center the whole thing and not * worry about it any more. */ bool isreadx = m_config->Read(wxT("Frame/PosX"), &posx, 20); bool isready = m_config->Read(wxT("Frame/PosY"), &posy, 20); if (!isreadx && !isready) { Center(); } else { Move(posx, posy); } /* Everything else should be done now, finally load the pages itself. */ LoadAndShowDialogPages(); } /* * Destructor for MainDlg. */ CMainDlg::~CMainDlg() { /** * Don't save the settings if we are iconized, otherwise we save our * size and position to nulls or smth, and it seriously screws us on * next startup. */ if (!IsIconized()) { m_config->SetPath(wxT("/Frame")); m_config->Write(wxT("Height"), GetSize().GetHeight()); m_config->Write(wxT("Width"), GetSize().GetWidth()); m_config->Write(wxT("PosX"), GetPosition().x); m_config->Write(wxT("PosY"), GetPosition().y); } /* * If we are instructed to remember the last open page between sessions, * write current active page to config file. This is done by determining * which toolbar button is currently selected (stored in m_lastbtn * variable) and substracting 1001 from that value to get 0 for * serverwnd, 1 for transferwnd etc, thus matching the codes we use * from CGUISettingsDlg class. */ int remember_last; m_config->Read(wxT("/General/Remember last"), &remember_last, true); if (remember_last) { m_config->Write(wxT("/General/Start page"), m_lastbtn-1001); } #ifdef __WXMSW__ systray->RemoveIcon(); delete systray; #endif /* Clean up our mess before leaving */ delete serverwnd; delete transferwnd; delete searchwnd; delete sharedfileswnd; delete messageswnd; delete statisticswnd; } /* * Changes content of the main frame by removing the old panel from m_mainsizer * and attaching new one. [start_up] defaults to false, and is required true * if we are calling this function on application start-up (don't hide old * (nonexistent) frame then). */ void CMainDlg::SetActiveDialog(wxWindow* dlg) { /** * On startup, we don't have activewnd * here yet, so don't hide anything. */ if (!start_up) { activewnd->Show(FALSE); m_mainsizer->Remove(activewnd); } m_mainsizer->Add(dlg,1,wxALIGN_LEFT|wxEXPAND|wxALL); dlg->Show(TRUE); activewnd=dlg; Layout(); start_up = false; } /* * Creates the toolbar on the top end of the main dialog. */ void CMainDlg::CreateMyToolBar() { int tool_align; m_config->Read( wxT("/General/Toolbar alignment"), &tool_align, wxTB_HORIZONTAL ); /* Construct the toolbar object */ tb = CreateToolBar( tool_align|wxNO_BORDER|wxTB_TEXT|wxTB_FLAT|wxTB_3DBUTTONS ); tb->SetToolBitmapSize(wxSize(32, 32)); tb->SetMargins( 2, 2 ); /* Add the buttons */ tb->AddTool( ID_BTN_CONNECT, _("Connect"), img->btn_connect, wxNullBitmap, wxITEM_NORMAL, _("Connect to any server") ); tb->AddSeparator(); tb->AddTool( ID_BTN_SERVERS, _("Servers"), img->btn_servers, wxNullBitmap, wxITEM_CHECK, _("Server list") ); tb->AddTool( ID_BTN_SEARCH, _("Search"), img->btn_search, wxNullBitmap, wxITEM_CHECK, _("Search files") ); tb->AddTool( ID_BTN_TRANSFER, _("Transfer"), img->btn_transfer, wxNullBitmap, wxITEM_CHECK, _("File Transfer") ); tb->AddTool( ID_BTN_SHARED_FILES, _("Shared Files"), img->btn_shared, wxNullBitmap, wxITEM_CHECK, _("Show shared files") ); tb->AddTool( ID_BTN_MESSAGES, _("Messages"), img->btn_messages, wxNullBitmap, wxITEM_CHECK, _("Chatting") ); tb->AddTool( ID_BTN_STATISTICS, _("Statistics"), img->btn_statistics, wxNullBitmap, wxITEM_CHECK, _("Show live statistics") ); tb->AddSeparator(); tb->AddTool( ID_BTN_GUISETTINGS, _("Preferences"), img->btn_guisettings, wxNullBitmap, wxITEM_NORMAL, _("Modify settings") ); /* And go live */ tb->Realize(); } /* * CloseWindow event function. This should destroy all open dialogs. */ void CMainDlg::OnCloseWindow( wxCloseEvent &event ){ /* Read from config if we should ask for permission before closing. */ bool prompt_exit; m_config->Read(wxT("/General/Prompt on exit"), &prompt_exit, true); if (prompt_exit) { if (wxMessageBox(_("Close xmule2-ui-wx?"), _("Question"), wxYES_NO|wxCENTRE|wxICON_QUESTION) == wxNO) { return; } } /* We reach this line if prompt_exit was false, * or Yes was clicked in messagebox */ Destroy(); } /** * Shows server page */ void CMainDlg::ShowServerWnd(wxCommandEvent &event) { if (show_tool) { tb->ToggleTool(m_lastbtn, false); tb->ToggleTool(ID_BTN_SERVERS, true); } m_lastbtn = ID_BTN_SERVERS; SetActiveDialog(serverwnd); /** * We send the server page a sizeevent to get the log boxes columns get * correct column widths (they are calculated dynamically according to * listctrl width. */ wxSizeEvent null_event; serverwnd->OnSize(null_event); /** * Force toolbar refresh to fix OS X drawing problems */ tb->Refresh(); } /** * Shows transfer page */ void CMainDlg::ShowTransferWnd(wxCommandEvent &event) { if (show_tool) { tb->ToggleTool(m_lastbtn, false); tb->ToggleTool(ID_BTN_TRANSFER, true); } m_lastbtn = ID_BTN_TRANSFER; SetActiveDialog(transferwnd); /** * Force toolbar refresh to fix OS X drawing problems */ tb->Refresh(); } /** * Shows search page */ void CMainDlg::ShowSearchWnd(wxCommandEvent &event) { if (show_tool) { tb->ToggleTool(m_lastbtn, false); tb->ToggleTool(ID_BTN_SEARCH, true); } m_lastbtn = ID_BTN_SEARCH; SetActiveDialog(searchwnd); /** * Force toolbar refresh to fix OS X drawing problems */ tb->Refresh(); } /** * Shows shared files page */ void CMainDlg::ShowSharedFilesWnd(wxCommandEvent &event) { if (show_tool) { tb->ToggleTool(m_lastbtn, false); tb->ToggleTool(ID_BTN_SHARED_FILES, true); } m_lastbtn = ID_BTN_SHARED_FILES; SetActiveDialog(sharedfileswnd); /** * Force toolbar refresh to fix OS X drawing problems */ tb->Refresh(); } /** * Shows messages page */ void CMainDlg::ShowMessagesWnd(wxCommandEvent &event) { if (show_tool) { tb->ToggleTool(m_lastbtn, false); tb->ToggleTool(ID_BTN_MESSAGES, true); } m_lastbtn = ID_BTN_MESSAGES; SetActiveDialog(messageswnd); /** * Force toolbar refresh to fix OS X drawing problems */ tb->Refresh(); } /** * Shows statistics page */ void CMainDlg::ShowStatisticsWnd(wxCommandEvent &event) { if (show_tool) { tb->ToggleTool(m_lastbtn, false); tb->ToggleTool(ID_BTN_STATISTICS, true); } m_lastbtn = ID_BTN_STATISTICS; SetActiveDialog(statisticswnd); /** * Force toolbar refresh to fix OS X drawing problems */ tb->Refresh(); } /** * Sends command to core to connect to any server */ void CMainDlg::ConnectToAnyServer(wxCommandEvent &event) { /** * Force toolbar refresh to fix OS X drawing problems */ tb->Refresh(); } /** * Displays GUI settings dialog */ void CMainDlg::ShowGUISettingsDlg(wxCommandEvent &event) { CGUISettingsDlg *guisettings = new CGUISettingsDlg( NULL, -1, _("Preferences"), wxDefaultPosition, wxDefaultSize ); guisettings->ShowModal(); delete guisettings; /** * Force toolbar refresh to fix OS X drawing problems */ tb->Refresh(); } /** * Loads all dialog pages, and displays either the one set from preferences, * last one, or default (server) page. */ void CMainDlg::LoadAndShowDialogPages() { int start_page; serverwnd = new CServerWnd(this); searchwnd = new CSearchWnd(this); transferwnd = new CTransferWnd(this); sharedfileswnd = new CSharedFilesWnd(this); messageswnd = new CMessagesWnd(this); statisticswnd = new CStatisticsWnd(this); m_config->Read(wxT("/General/Start page"), &start_page, 0); wxCommandEvent null_event; switch (start_page) { case 0: ShowServerWnd(null_event); break; case 1: ShowTransferWnd(null_event); break; case 2: ShowSearchWnd(null_event); break; case 3: ShowSharedFilesWnd(null_event); break; case 4: ShowMessagesWnd(null_event); break; case 5: ShowStatisticsWnd(null_event); break; default: ShowServerWnd(null_event); break; } } /** * Generates our menubar. */ void CMainDlg::CreateMenuBar() { wxMenu *file_menu = new wxMenu(); file_menu->Append(ID_FILE_CONNECT, _("Connect")); file_menu->Append(ID_FILE_EXIT, _("Quit")); wxMenu *edit_menu = new wxMenu(); edit_menu->Append(ID_EDIT_GUI_SETTINGS, _("Preferences")); wxMenu *view_menu = new wxMenu(); view_menu->Append(ID_VIEW_SERVERS, _("Servers")); view_menu->Append(ID_VIEW_TRANSFER, _("Transfer")); view_menu->Append(ID_VIEW_SEARCH, _("Search")); view_menu->Append(ID_VIEW_SHARED_FILES, _("Shared Files")); view_menu->Append(ID_VIEW_MESSAGES, _("Messages")); view_menu->Append(ID_VIEW_STATISTICS, _("Statistics")); wxMenu *help_menu = new wxMenu(); help_menu->Append(ID_HELP_HELP, _("Help")); help_menu->Append(ID_HELP_ABOUT, _("About...")); wxMenuBar *menubar = new wxMenuBar(); menubar->Append(file_menu, _("File")); menubar->Append(edit_menu, _("Edit")); menubar->Append(view_menu, _("View")); menubar->Append(help_menu, _("Help")); SetMenuBar(menubar); } --- NEW FILE: MainDlg.h --- /* * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * 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 __MAINDLG_H__ #define __MAINDLG_H__ #ifdef __GNUG__ #pragma interface "MainDlg.h" #endif // Include wxWindows' headers #ifndef WX_PRECOMP #include <wx/wx.h> #endif /* Include local headers */ #include "wxInterface_wdr.h" #include "defines.h" #include "StatusBar.h" #include "ServerWnd.h" #include "TransferWnd.h" #include "SearchWnd.h" #include "SharedFilesWnd.h" #include "MessagesWnd.h" #include "StatisticsWnd.h" #include "SysTray.h" /* * Constants for MainDlg */ #define ID_QUIT 100 #define ID_ABOUT 101 /* * MainDlg class. The main dialog functions like Toolbar and Statusbar * stuff go in here. */ extern class CMainDlg *mainframe; class CMainDlg: public wxFrame { public: /* Constructors and destructors */ CMainDlg( wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint& pos, const wxSize& size, long style, wxLocale &m_locale ); ~CMainDlg(); wxLocale &m_locale; private: DECLARE_EVENT_TABLE() /* Member event handler functions */ void OnCloseWindow( wxCloseEvent &event ); void OnBtnGUIOk(wxCommandEvent &event); void OnBtnGUICancel(wxCommandEvent &event); /* Member functions */ void SetActiveDialog(wxWindow* dlg); void CreateMyToolBar(); void CreateSysTray(); void CreateMenuBar(); void LoadAndShowDialogPages(); void ConnectToAnyServer(wxCommandEvent &event); void ShowServerWnd(wxCommandEvent &event); void ShowTransferWnd(wxCommandEvent &event); void ShowSearchWnd(wxCommandEvent &event); void ShowSharedFilesWnd(wxCommandEvent &event); void ShowMessagesWnd(wxCommandEvent &event); void ShowStatisticsWnd(wxCommandEvent &event); void ShowGUISettingsDlg(wxCommandEvent &event); /* Member variables */ bool show_tool; // Wether toolbar should be shown or not. bool start_up; // Should we remember last page // between sessions or not int m_lastbtn; // Last toggled toolbar button wxSizer *m_mainsizer; // Sizer to make dialog pages switching easier. wxToolBar *tb; // Main toolbar wxWindow *activewnd; // Current active dialog page }; #endif --- NEW FILE: wxInterface.cpp --- /* * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * 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 */ #ifdef __GNUG__ #pragma implementation "wxInterface.h" #endif // For compilers that support precompilation #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #include "wxInterface.h" #include "MainDlg.h" /* * Base class for wxInterface. Everything else starts from here. */ IMPLEMENT_APP(wxInterface) class CImages *img; wxConfigBase *m_config; class CMainDlg *mainframe; /* * Main program initialization. Command arguments should be checked here, and * main wxInterface Dialog drawn. */ bool wxInterface::OnInit() { int show_splash; SetVendorName(wxT("ShareDaemon")); SetAppName(wxT("wxInterface")); ::wxInitAllImageHandlers(); m_config = wxConfigBase::Get(); CheckAndAddSupportedIconSets(); img = new CImages(); m_config->Read(wxT("/General/Show splashscreen"), &show_splash); if (show_splash) { /* Display the splash screen */ splash = new wxSplashScreen( img->logo, wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT, 2000, NULL, -1 ); } Localize(); /* Display the main dialog */ mainframe = new CMainDlg( NULL, -1, APPVER_LONG, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE| wxNO_FULL_REPAINT_ON_RESIZE, m_locale ); mainframe->Show( TRUE ); if (show_splash) { splash->Raise(); } return TRUE; } /* * Main program shutdown function. If anything needs to be cleaned up, do it * here. */ int wxInterface::OnExit() { /* Save configuration object to disk */ delete m_config->Set(NULL); /* Delete images class (it doesn't get automatically deleted by wx */ delete img; /* Return true :) */ return 0; } /** * First we call CheckAndAddSupportedLangs() to add built-in languages to config * object. Then we add catalog prefixes (note that we need ::Resources:lang also * to be compatible with Mac OS packaging standards). Then simply read active * language from config object, and add the catalog. */ void wxInterface::Localize() { wxString curlang; CheckAndAddSupportedLangs(); /* Set localization files directories */ m_locale.AddCatalogLookupPathPrefix(wxT("lang/")); #if defined(__WXMAC__) && !defined(__MACH__) m_locale.AddCatalogLookupPathPrefix(wxT("::Resources:lang")); #endif m_config->SetPath(wxT("/General/Lang")); m_config->Read(wxT("CurLang"), &curlang); m_locale.Init(GetLangType(curlang)); m_locale.AddCatalog(curlang); } /** * This method's purpose is ensuring that all supported languages * (translations shipped with releases) are added to config file. This is done * by creating a list of supported languages (supportedlangs), then reading * all languages from config object (conflangs), and then comparing those two * arrays, adding missing elements to conflangs. Finally, the new languages * array (conflangs) is written back into config object. */ void wxInterface::CheckAndAddSupportedLangs() { wxArrayString conflangs, supportedlangs; wxString tmpname; int numlang; int i; // loop counter /* List of supported langs - add new ones to the bottom */ supportedlangs.Add(wxT("Default")); supportedlangs.Add(wxT("German")); supportedlangs.Add(wxT("Estonian")); m_config->SetPath(wxT("/General/Lang")); m_config->Read(wxT("NumLang"), &numlang, 1); /* Loop through config and read all languages to conflangs array */ for (i=0; i<numlang; i++) { m_config->Read( wxString::Format(wxT("%d"), i), &tmpname, wxT("Default") ); conflangs.Add(tmpname); } /** * Loop through supportedlangs array * and add missing items to conflangs */ for (i=0; i<(int)supportedlangs.GetCount(); i++) { if (conflangs.Index(supportedlangs.Item(i)) == wxNOT_FOUND) { conflangs.Add(supportedlangs.Item(i)); } } /* Write conflangs array back to config */ for (i=0; i<(int)conflangs.GetCount(); i++) { m_config->Write( wxString::Format(wxT("%d"), i), conflangs.Item(i) ); } m_config->Write(wxT("NumLang"), (int)conflangs.GetCount()); } /** * Same as above in CheckAndAddSupportedLangs() function, we loop through our * built-in iconsets list and add the missing elements to config object. */ void wxInterface::CheckAndAddSupportedIconSets() { wxArrayString conficonsets, supportediconsets; wxString tmpname; int numiconsets; int i; // loop counter /* List of supported langs - add new ones to the bottom */ supportediconsets.Add(wxT("Default")); supportediconsets.Add(wxT("eMule_Greyscale")); supportediconsets.Add(wxT("eMule_Inverted")); m_config->SetPath(wxT("/General/IconSets")); m_config->Read(wxT("NumIconSets"), &numiconsets, 1); /* Loop through config and read all languages to conflangs array */ for (i=0; i<numiconsets; i++) { m_config->Read( wxString::Format(wxT("%d"), i), &tmpname, wxT("Default") ); conficonsets.Add(tmpname); } /** * Loop through supportedlangs array and *add missing items to conflangs */ for (i=0; i<(int)supportediconsets.GetCount(); i++) { if (conficonsets.Index(supportediconsets.Item(i)) == wxNOT_FOUND) { conficonsets.Add(supportediconsets.Item(i)); } } /* Write conflangs array back to config */ for (i=0; i<(int)conficonsets.GetCount(); i++) { m_config->Write( wxString::Format(wxT("%d"), i), conficonsets.Item(i) ); } m_config->Write(wxT("NumIconSets"), (int)conficonsets.GetCount()); } /** * This method's purpose is to determine the wxWindows constant for given * language (affects dates/times/currencies etc). Input variable [lang] * should be any language name. On success, correct localization setting * is returned, while if no match is found, wxLANGUAGE_DEFAULT is * returned (use system setting). */ int wxInterface::GetLangType(const wxString lang) { if (lang == wxT("German")) { return wxLANGUAGE_GERMAN; } else if (lang == wxT("Estonian")) { return wxLANGUAGE_ESTONIAN; } else { return wxLANGUAGE_DEFAULT; } } --- NEW FILE: wxInterface.dev --- [Project] FileName=xmule2-ui-wx.dev Name=xmule2-ui-wx UnitCount=55 Type=0 Ver=1 ObjFiles= Includes= Libs= PrivateResource=xmule2-ui-wx_private.rc ResourceIncludes=G:\Dev-Cpp\include MakeIncludes= Compiler= CppCompiler=-D__HAVE_REMOVE_GROWABLE_COL__ -D_X86_=1 -DWIN32 -DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__ -D__WIN32__ -mthreads -DSTRICT -D__WXMSW__ -D__WINDOWS__ -Wall -fno-pcc-struct-return -O2 -fno-rtti -fno-exceptions_@@_ Linker=-lwxmsw241 -lstdc++ -lgcc -lodbc32 -lwsock32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -ladvapi32 -lopengl32 -lglu32 -lole32 -loleaut32 -luuid _@@_ IsCpp=1 Icon=xmule2-ui-wx.ico ExeOutput= ObjectOutput= OverrideOutput=0 OverrideOutputName=xmule2-ui-wx.exe HostApplication= Folders=doc,src CommandLine= IncludeVersionInfo=0 SupportXPThemes=1 CompilerSet=0 CompilerSettings=000000000100100000 [Unit1] FileName=defines.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit2] FileName=SearchListCtrl.cpp CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit3] FileName=SearchListCtrl.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit4] FileName=SearchWnd.cpp CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit5] FileName=SearchWnd.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit6] FileName=ServerListCtrl.cpp CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit7] FileName=ServerListCtrl.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit8] FileName=ServerWnd.cpp CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit9] FileName=ServerWnd.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit10] FileName=StatusBar.cpp CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit11] FileName=StatusBar.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit12] FileName=xMuleDlg.cpp CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit13] FileName=xMuleDlg.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit14] FileName=xMuleGUI.cpp CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit15] FileName=xMuleGUI.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit16] FileName=xMuleGUI_wdr.cpp CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit17] FileName=xMuleGUI_wdr.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit18] FileName=xmule2-ui-wx_private.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit19] FileName=xmule2-ui-wx_private.rc CompileCpp=1 Folder=src Compile=1 Link=0 Priority=1000 OverrideBuildCmd=0 BuildCmd= [VersionInfo] Major=0 Minor=1 Release=1 Build=1 LanguageID=1033 CharsetID=1252 CompanyName= FileVersion= FileDescription=Developed using the Dev-C++ IDE InternalName= LegalCopyright= LegalTrademarks= OriginalFilename= ProductName= ProductVersion= AutoIncBuildNr=0 [Unit20] FileName=..\TODO CompileCpp=1 Folder= Compile=0 Link=0 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit21] FileName=..\INSTALL Folder= Compile=0 Link=0 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit22] FileName=..\LICENCE Folder= Compile=0 Link=0 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit23] FileName=..\Changelog Folder= Compile=0 Link=0 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit24] FileName=..\doc\Source Folder=doc Compile=0 Link=0 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit25] FileName=TransferWnd.cpp Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= CompileCpp=1 [Unit26] FileName=TransferWnd.h Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= CompileCpp=1 [Unit27] FileName=SharedFilesWnd.cpp CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit28] FileName=SharedFilesWnd.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit29] FileName=MessagesWnd.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit30] FileName=MessagesWnd.cpp CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit31] FileName=StatisticsWnd.cpp CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit32] FileName=StatisticsWnd.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit33] FileName=ColorFrameCtrl.cpp CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit34] FileName=ColorFrameCtrl.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit35] FileName=StatisticsTreeCtrl.cpp CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit36] FileName=StatisticsTreeCtrl.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit37] FileName=SharedFilesListCtrl.cpp CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit38] FileName=SharedFilesListCtrl.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit39] FileName=DownloadListCtrl.cpp CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit40] FileName=DownloadListCtrl.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit42] FileName=UploadListCtrl.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit41] FileName=UploadListCtrl.cpp CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit44] FileName=QueueListCtrl.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit43] FileName=QueueListCtrl.cpp CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit45] FileName=KnownListCtrl.cpp CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit46] FileName=KnownListCtrl.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit47] FileName=GUISettingsDlg.cpp CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit48] FileName=GUISettingsDlg.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit49] FileName=MListCtrl.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit50] FileName=MListCtrl.cpp CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit51] FileName=SysTray.cpp CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit52] FileName=SysTray.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit53] FileName=..\TRANSLATION CompileCpp=1 Folder= Compile=0 Link=0 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit54] FileName=Images.h CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [Unit55] FileName=Images.cpp CompileCpp=1 Folder=src Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= --- NEW FILE: wxInterface.h --- /* * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * 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 __WXINTERFACE_H__ #define __WXINTERFACE_H__ #ifdef __GNUG__ #pragma interface "wxInterface.h" #endif // Include wxWindows' headers #ifndef WX_PRECOMP #include <wx/wx.h> #endif // Include private headers #include "wxInterface_wdr.h" #include "wxInterface.h" #include "defines.h" /* * Base class for wxInterface. Everything else starts from here. */ class wxInterface: public wxApp { public: virtual bool OnInit(); virtual int OnExit(); protected: wxLocale m_locale; private: wxSplashScreen *splash; void Localize(); void CheckAndAddSupportedLangs(); void CheckAndAddSupportedIconSets(); int GetLangType(const wxString lang); }; #endif --- NEW FILE: wxInterface.ico --- (This appears to be a binary file; contents omitted.) --- NEW FILE: wxInterface.wdr --- (This appears to be a binary file; contents omitted.) --- NEW FILE: wxInterface_private.h --- // THIS FILE WILL BE OVERWRITTEN BY DEV-C++! // DO NOT EDIT! #ifndef XMULE2-UI-WX_PRIVATE_H #define XMULE2-UI-WX_PRIVATE_H // VERSION DEFINITIONS #define VER_STRING "0.1.1.1" #define VER_MAJOR 0 #define VER_MINOR 1 #define VER_RELEASE 1 #define VER_BUILD 1 #define COMPANY_NAME "" #define FILE_VERSION "" #define FILE_DESCRIPTION "Developed using the Dev-C++ IDE" #define INTERNAL_NAME "" #define LEGAL_COPYRIGHT "" #define LEGAL_TRADEMARKS "" #define ORIGINAL_FILENAME "" #define PRODUCT_NAME "" #define PRODUCT_VERSION "" #endif //XMULE2-UI-WX_PRIVATE_H --- NEW FILE: wxInterface_private.rc --- // THIS FILE WILL BE OVERWRITTEN BY DEV-C++! // DO NOT EDIT! //#include "xmule2-ui-wx_private.rc" #include <wx/msw/wx.rc> A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "xmule2-ui-wx.ico" // // SUPPORT FOR WINDOWS XP THEMES: // THIS WILL MAKE THE PROGRAM USE THE COMMON CONTROLS // LIBRARY VERSION 6.0 (IF IT IS AVAILABLE) // 1 24 "wxInterface.exe.Manifest" --- NEW FILE: wxInterface_wdr.cpp --- //------------------------------------------------------------------------------ // Source code generated by wxDesigner from file: wxInterface.wdr // Do not modify this file, all changes will be lost! //------------------------------------------------------------------------------ #ifdef __GNUG__ #pragma implementation "wxInterface_wdr.h" #endif // For compilers that support precompilation #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif // Include private header #include "wxInterface_wdr.h" [...1358 lines suppressed...] "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa" }; wxBitmap bitmap( xpm_data ); return bitmap; } return wxNullBitmap; } // End of generated file --- NEW FILE: wxInterface_wdr.h --- //------------------------------------------------------------------------------ // Header generated by wxDesigner from file: wxInterface.wdr // Do not modify this file, all changes will be lost! //------------------------------------------------------------------------------ #ifndef __WDR_wxInterface_H__ #define __WDR_wxInterface_H__ #if defined(__GNUG__) && !defined(__APPLE__) #pragma interface "wxInterface_wdr.h" #endif // Include wxWindows' headers #ifndef WX_PRECOMP #include <wx/wx.h> #endif #include <wx/image.h> #include <wx/statline.h> #include <wx/spinbutt.h> #include <wx/spinctrl.h> #include <wx/splitter.h> #include <wx/listctrl.h> #include <wx/treectrl.h> #include <wx/notebook.h> #include <wx/grid.h> // Declare window functions #define ID_SERVERS_IMAGE 10000 #define ID_TXT_SERVER 10001 #define ID_SERVERLISTCTRL 10002 wxSizer *Server_List( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); #define ID_SERVERINFO 10003 wxSizer *ServerInfo( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); #define ID_LOG 10004 wxSizer *Log( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); #define ID_DEBUGLOG 10005 wxSizer *DebugLog( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); #define ID_TEXT 10006 #define ID_SEARCHSTRING 10007 #define ID_SEARCHMETHOD 10008 #define ID_SEARCHTYPE 10009 #define ID_BTN_RESET 10010 #define ID_MINSIZE 10011 #define ID_MAXSIZE 10012 #define ID_AVAIL 10013 #define ID_EXTENSION 10014 #define ID_TEXTCTRL 10015 #define ID_SEARCH_RESULTS_IMAGE 10016 #define ID_BUTTON 10017 #define ID_SEARCHRESULTS 10018 #define ID_GAUGE 10019 wxSizer *SearchWnd( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); wxSizer *ContentSizer( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); #define ID_SHARED_FILES_IMAGE 10020 #define ID_TXT_SHARED 10021 #define ID_SHAREDLISTCTRL 10022 #define ID_CURSES_REQUESTS 10023 #define ID_CURSES_ACCEPTED_UPLOADS 10024 #define ID_CURSES_TRANSFERRED 10025 #define ID_G_REQUESTS 10026 #define ID_G_UPLOADS 10027 #define ID_G_TRANSFERRED 10028 #define ID_TOTAL_REQUESTS 10029 #define ID_TOTAL_ACCEPTED_UPLOADS 10030 #define ID_TOTAL_TRANSFERRED 10031 wxSizer *SharedFilesWnd( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); #define ID_FRIEND_IMAGE 10032 #define ID_LISTCTRL 10033 #define ID_MESSAGES_IMAGE 10034 #define ID_NOTEBOOK 10035 wxSizer *MessagesWnd( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); #define BTN_STAT 10036 #define ID_STATSTREECTRL 10037 #define ID_FOREIGN 10038 #define ID_CON_GRAPH 10039 #define ID_DL_SES 10040 #define ID_DL_CUR 10041 #define ID_DL_AVG 10042 #define ID_DL_GRAPH 10043 #define ID_UL_SES 10044 #define ID_UL_CUR 10045 #define ID_UL_AVG 10046 #define ID_UL_GRAPH 10047 wxSizer *StatisticsWnd( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); #define ID_LANG 10048 #define ID_BTN_ADDLANG 10049 #define ID_BTN_REMOVELANG 10050 #define ID_ICONSET 10051 #define ID_BTN_ADDICONSET 10052 #define ID_BTN_REMOVEICONSET 10053 #define ID_FONT 10054 #define ID_STARTPAGE 10055 #define ID_REMEMBER_LAST 10056 #define ID_SHOWSPLASH 10057 #define ID_PROMPTEXIT 10058 #define ID_SHOWTOOL 10059 #define ID_TOOLALIGN 10060 #define ID_SHOWMENU 10061 #define GUI_OK 10062 #define GUI_CANCEL 10063 wxSizer *Dlg_GUI_Settings( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); #define ID_LOGBOOK 10064 wxSizer *Server_Logs( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); extern wxSizer *sizer_updateserver; #define ID_BTN_SHOW_UPDATELIST 10065 extern wxSizer *sizer_serversettings; #define ID_BTN_SHOW_SERVERSETTINGS 10066 extern wxSizer *sizer_portsettings; #define ID_BTN_SHOW_PORT_OPTIONS 10067 extern wxSizer *sizer_addserver; #define ID_BTN_SHOW_ADDSERVER 10068 extern wxSizer *sizer_logoptions; #define ID_BTN_SHOW_LOGGINGOPTIONS 10069 wxSizer *Server_Sidebar( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); #define ID_SERVER_IP 10070 #define ID_SERVERIP 10071 #define ID_ADDTOLIST 10072 wxSizer *Server_AddServerPanel( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); #define ID_SERVERLISTURL 10073 #define ID_UPDATE 10074 wxSizer *Server_UpdatePanel( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); #define ID_SS_AUTO_CONNECT 10075 #define ID_SS_AC_STATIC_ONLY 10076 #define ID_LINE 10077 #define ID_SS_SERVER_IMG 10078 #define ID_SS_SERVER_NAME 10079 #define ID_CHECK_SS_STATIC 10080 #define ID_SS_PRIO 10081 wxSizer *Server_SettingsPanel( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); #define ID_CHECK_LINE_LIMIT 10082 #define ID_TXT_LINE_LIMIT 10083 #define ID_CHECK_SAVE_TO_DISK 10084 #define ID_BTN_CLEAR_LOGS 10085 wxSizer *Server_LogOptionsPanel( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); #define ID_LANG_NAME 10086 #define ID_BTN_ADD_LANG_OK 10087 #define ID_BTN_ADD_LANG_CANCEL 10088 wxSizer *Dlg_AddLanguage( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); #define ID_CHECKBOX 10089 wxSizer *Server_PortSettingsPanel( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); #define ID_BTN_ADDICONSET_OK 10090 #define ID_BTN_ADDICONSET_CANCEL 10091 wxSizer *Dlg_AddIconSet( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); // Declare menubar functions // Declare toolbar functions // Declare bitmap functions #define ID_NULL_BMP 10092 wxBitmap Icons( size_t index ); #endif // End of generated file Index: ColorFrameCtrl.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/ColorFrameCtrl.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ColorFrameCtrl.cpp 7 Aug 2003 21:38:06 -0000 1.1 +++ ColorFrameCtrl.cpp 20 Nov 2003 01:27:26 -0000 1.2 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Timo Kujala <ti...@us...> * * This program is free software; you can redistribute it and/or modify Index: ColorFrameCtrl.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/ColorFrameCtrl.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ColorFrameCtrl.h 17 Nov 2003 22:30:45 -0000 1.5 +++ ColorFrameCtrl.h 20 Nov 2003 01:27:26 -0000 1.6 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Timo Kujala <ti...@us...> * * This program is free software; you can redistribute it and/or modify Index: DownloadListCtrl.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/DownloadListCtrl.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- DownloadListCtrl.cpp 6 Sep 2003 12:14:23 -0000 1.7 +++ DownloadListCtrl.cpp 20 Nov 2003 01:27:26 -0000 1.8 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify Index: DownloadListCtrl.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/DownloadListCtrl.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- DownloadListCtrl.h 5 Sep 2003 20:58:27 -0000 1.5 +++ DownloadListCtrl.h 20 Nov 2003 01:27:26 -0000 1.6 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify @@ -28,7 +28,7 @@ #include "wx/wx.h" #endif -#include "xMuleGUI_wdr.h" +#include "wxInterface_wdr.h" #include "defines.h" // WDR: class declarations Index: GUISettingsDlg.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/GUISettingsDlg.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- GUISettingsDlg.cpp 17 Nov 2003 03:59:54 -0000 1.15 +++ GUISettingsDlg.cpp 20 Nov 2003 01:27:26 -0000 1.16 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify @@ -29,7 +29,7 @@ #endif #include "GUISettingsDlg.h" -#include "xMuleDlg.h" +#include "MainDlg.h" /********************* * CGUISettingsDlg class Index: GUISettingsDlg.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/GUISettingsDlg.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- GUISettingsDlg.h 17 Nov 2003 03:59:54 -0000 1.10 +++ GUISettingsDlg.h 20 Nov 2003 01:27:26 -0000 1.11 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify @@ -28,7 +28,7 @@ #include "wx/wx.h" #endif -#include "xMuleGUI_wdr.h" +#include "wxInterface_wdr.h" #include "defines.h" class CGUISettingsDlg: public wxDialog { Index: Images.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Images.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- Images.cpp 17 Nov 2003 21:41:27 -0000 1.11 +++ Images.cpp 20 Nov 2003 01:27:26 -0000 1.12 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify Index: Images.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Images.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- Images.h 17 Nov 2003 21:41:27 -0000 1.9 +++ Images.h 20 Nov 2003 01:27:26 -0000 1.10 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify Index: KnownListCtrl.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/KnownListCtrl.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- KnownListCtrl.cpp 6 Sep 2003 12:14:23 -0000 1.7 +++ KnownListCtrl.cpp 20 Nov 2003 01:27:26 -0000 1.8 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify Index: KnownListCtrl.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/KnownListCtrl.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- KnownListCtrl.h 5 Sep 2003 20:58:27 -0000 1.5 +++ KnownListCtrl.h 20 Nov 2003 01:27:26 -0000 1.6 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify @@ -28,7 +28,7 @@ #include "wx/wx.h" #endif -#include "xMuleGUI_wdr.h" +#include "wxInterface_wdr.h" #include "defines.h" // WDR: class declarations Index: MListCtrl.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MListCtrl.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- MListCtrl.cpp 17 Nov 2003 03:59:54 -0000 1.6 +++ MListCtrl.cpp 20 Nov 2003 01:27:26 -0000 1.7 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify Index: MListCtrl.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MListCtrl.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- MListCtrl.h 23 Aug 2003 17:27:10 -0000 1.3 +++ MListCtrl.h 20 Nov 2003 01:27:26 -0000 1.4 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify @@ -28,7 +28,7 @@ #include "wx/wx.h" #endif -#include "xMuleGUI_wdr.h" +#include "wxInterface_wdr.h" #include "defines.h" class CMListCtrl: public wxListCtrl { Index: Makefile =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Makefile,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- Makefile 9 Sep 2003 18:13:12 -0000 1.26 +++ Makefile 20 Nov 2003 01:27:26 -0000 1.27 @@ -1,16 +1,18 @@ WXCONFIG = wx-config CXX = $(shell $(WXCONFIG) --cxx) -PROGRAM = xmule2-ui-wx +PROGRAM = wxInterface OBJECTS = ColorFrameCtrl.o \ DownloadListCtrl.o \ GUISettingsDlg.o \ Images.o \ KnownListCtrl.o \ + MainDlg.o \ MessagesWnd.o \ MListCtrl.o \ QueueListCtrl.o \ + SBPanel.o \ SearchListCtrl.o \ SearchWnd.o \ ServerListCtrl.o \ @@ -23,10 +25,9 @@ SysTray.o \ TransferWnd.o \ UploadListCtrl.o \ - xMuleDlg.o \ - xMuleGUI.o \ - xMuleGUI_wdr.o \ -# xmule2-ui-wx_private.res \ + wxInterface.o \ + wxInterface_wdr.o \ +# wxInterface_private.res \ # uncomment xmule2-ui-wx_private.res file under win32, # comment out on all other systems. Index: Makefile.b32 =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Makefile.b32,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- Makefile.b32 27 Aug 2003 00:45:20 -0000 1.18 +++ Makefile.b32 20 Nov 2003 01:27:26 -0000 1.19 @@ -2,14 +2,15 @@ TARGET=xmule2-ui-wx OBJECTS = ColorFrameCtrl.obj \ - CoreSettingsDlg.obj \ DownloadListCtrl.obj \ GUISettingsDlg.obj \ KnownListCtrl.obj \ + MainDlg.obj \ MessagesWnd.obj \ MListCtrl.obj \ TransferWnd.obj \ QueueListCtrl.obj \ + SBPanel.obj \ SearchListCtrl.obj \ SearchWnd.obj \ ServerListCtrl.obj \ @@ -21,8 +22,7 @@ StatusBar.obj \ SysTray.obj \ UploadListCtrl.obj \ - xMuleDlg.obj \ - xMuleGUI.obj \ - xMuleGUI_wdr.obj \ + wxInterface.obj \ + wxInterface_wdr.obj !include $(WXDIR)\src\makeprog.b32 Index: MessagesWnd.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MessagesWnd.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- MessagesWnd.cpp 5 Sep 2003 20:58:27 -0000 1.8 +++ MessagesWnd.cpp 20 Nov 2003 01:27:26 -0000 1.9 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify Index: MessagesWnd.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MessagesWnd.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- MessagesWnd.h 17 Nov 2003 03:59:54 -0000 1.6 +++ MessagesWnd.h 20 Nov 2003 01:27:26 -0000 1.7 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify @@ -28,7 +28,7 @@ #include "wx/wx.h" #endif -#include "xMuleGUI_wdr.h" +#include "wxInterface_wdr.h" #include "defines.h" class CMessagesWnd: public wxPanel { Index: QueueListCtrl.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/QueueListCtrl.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- QueueListCtrl.cpp 6 Sep 2003 12:14:23 -0000 1.7 +++ QueueListCtrl.cpp 20 Nov 2003 01:27:26 -0000 1.8 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify Index: QueueListCtrl.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/QueueListCtrl.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- QueueListCtrl.h 5 Sep 2003 20:58:27 -0000 1.5 +++ QueueListCtrl.h 20 Nov 2003 01:27:26 -0000 1.6 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify @@ -28,7 +28,7 @@ #include "wx/wx.h" #endif -#include "xMuleGUI_wdr.h" +#include "wxInterface_wdr.h" #include "defines.h" // WDR: class declarations Index: SBPanel.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SBPanel.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SBPanel.cpp 19 Nov 2003 23:22:07 -0000 1.1 +++ SBPanel.cpp 20 Nov 2003 01:27:26 -0000 1.2 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify Index: SBPanel.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SBPanel.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SBPanel.h 19 Nov 2003 23:22:07 -0000 1.1 +++ SBPanel.h 20 Nov 2003 01:27:26 -0000 1.2 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify Index: SearchListCtrl.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SearchListCtrl.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- SearchListCtrl.cpp 17 Nov 2003 03:59:54 -0000 1.7 +++ SearchListCtrl.cpp 20 Nov 2003 01:27:26 -0000 1.8 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify Index: SearchListCtrl.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SearchListCtrl.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- SearchListCtrl.h 20 Aug 2003 12:47:48 -0000 1.4 +++ SearchListCtrl.h 20 Nov 2003 01:27:26 -0000 1.5 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify @@ -28,7 +28,7 @@ #include "wx/wx.h" #endif -#include "xMuleGUI_wdr.h" +#include "wxInterface_wdr.h" #include "defines.h" // WDR: class declarations Index: SearchWnd.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SearchWnd.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- SearchWnd.cpp 5 Sep 2003 20:50:59 -0000 1.13 +++ SearchWnd.cpp 20 Nov 2003 01:27:26 -0000 1.14 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify @@ -29,7 +29,7 @@ #endif #include "SearchWnd.h" -#include "xMuleDlg.h" +#include "MainDlg.h" /* * CSearchWnd class. Index: SearchWnd.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SearchWnd.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- SearchWnd.h 17 Nov 2003 03:59:54 -0000 1.8 +++ SearchWnd.h 20 Nov 2003 01:27:26 -0000 1.9 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify @@ -29,7 +29,7 @@ #endif /* Private headers */ -#include "xMuleGUI_wdr.h" +#include "wxInterface_wdr.h" #include "defines.h" /* Index: ServerListCtrl.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/ServerListCtrl.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- ServerListCtrl.cpp 6 Sep 2003 12:14:23 -0000 1.9 +++ ServerListCtrl.cpp 20 Nov 2003 01:27:26 -0000 1.10 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify Index: ServerListCtrl.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/ServerListCtrl.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ServerListCtrl.h 5 Sep 2003 01:22:20 -0000 1.6 +++ ServerListCtrl.h 20 Nov 2003 01:27:26 -0000 1.7 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify @@ -28,7 +28,7 @@ #include "wx/wx.h" #endif -#include "xMuleGUI_wdr.h" +#include "wxInterface_wdr.h" #include "defines.h" #include "ServerWnd.h" Index: ServerWnd.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/ServerWnd.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- ServerWnd.cpp 19 Nov 2003 23:22:07 -0000 1.36 +++ ServerWnd.cpp 20 Nov 2003 01:27:26 -0000 1.37 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify Index: ServerWnd.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/ServerWnd.h,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- ServerWnd.h 19 Nov 2003 23:22:07 -0000 1.25 +++ ServerWnd.h 20 Nov 2003 01:27:26 -0000 1.26 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify @@ -32,10 +32,10 @@ #include <wx/datetime.h> /* Private headers */ -#include "xMuleGUI_wdr.h" #include "defines.h" +#include "wxInterface_wdr.h" #include "ServerListCtrl.h" -#include "xMuleDlg.h" +#include "MainDlg.h" #include "SBPanel.h" /* Index: SharedFilesListCtrl.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SharedFilesListCtrl.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- SharedFilesListCtrl.cpp 6 Sep 2003 12:14:23 -0000 1.7 +++ SharedFilesListCtrl.cpp 20 Nov 2003 01:27:26 -0000 1.8 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify Index: SharedFilesListCtrl.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SharedFilesListCtrl.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- SharedFilesListCtrl.h 5 Sep 2003 20:58:27 -0000 1.5 +++ SharedFilesListCtrl.h 20 Nov 2003 01:27:26 -0000 1.6 @@ -1,5 +1,5 @@ /* - * This file is part of xMule2. + * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify @@ -28,7 +28,7 @@ #include "wx/wx.h" #endif -#include "xMuleGUI_wdr.h" +#include "wxInterface_wdr.h" #include "defines.h" // WDR: class declarations ... [truncated message content] |
From: <ma...@us...> - 2003-11-20 01:28:10
|
Update of /cvsroot/sharedaemon/ui-wx In directory sc8-pr-cvs1:/tmp/cvs-serv31500 Modified Files: Changelog INSTALL TRANSLATION Log Message: Renamed xMule* files to wxInterface*, renamed xMuleGUI class to wxInterface, xMuleDlg to CMainFrame and changed all xmule2 stuff in source to wxInterface. Index: Changelog =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/Changelog,v retrieving revision 1.87 retrieving revision 1.88 diff -u -d -r1.87 -r1.88 --- Changelog 19 Nov 2003 23:22:07 -0000 1.87 +++ Changelog 20 Nov 2003 01:27:26 -0000 1.88 @@ -1,8 +1,9 @@ - ----------------------------- - |Changelog for xmule2-ui-wx | - ----------------------------- + ---------------------------------------- + |Changelog for ShareDaemon wxInterface | + ---------------------------------------- 2003/11/20 Alo Sarv + * Renamed xMule* files to wxInterface* files. * Reimplemented SideBar in a dynamic manner. 2003/11/17 Alo Sarv Index: INSTALL =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/INSTALL,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- INSTALL 4 Sep 2003 01:23:19 -0000 1.5 +++ INSTALL 20 Nov 2003 01:27:26 -0000 1.6 @@ -1,6 +1,6 @@ INSTALLATION NOTES -Please note that this program is only a user interface to xmule2-core. It +Please note that this program is only a user interface to ShareDaemon core. It sends commands to the core and acts based on what core sends back. If no core is running, this program doesn't do anything. @@ -8,7 +8,7 @@ Currently, there is no automatic configure system, so go to src/Makefile, and edit the first line to point to the correct location of your wx-config file. Then simply type 'make', and run the program - with './xmule2-ui-wx'. There is no 'make install' script yet either. + with './wxInterface'. There is no 'make install' script yet either. -- wxWindows patching: src/generic/listctrl.cpp (listctrl.patch) As wxListCtrl doesn't support columns with width less than 10 under @@ -25,7 +25,7 @@ file in wxWindows sources for sidebar hiding code to work. Do so using flexgridsizer.patch file (apply in the src/common directory of wxWindows sources), and add __HAVE_REMOVE_GROWABLE_COL__ define to - xmule2-ui-wx Makefile to enable the hiding code. + wxInterfce Makefile to enable the hiding code. * Note about GTK2 As GTK2 support in wxWindows library is, according to them, Index: TRANSLATION =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/TRANSLATION,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- TRANSLATION 8 Sep 2003 22:32:12 -0000 1.2 +++ TRANSLATION 20 Nov 2003 01:27:26 -0000 1.3 @@ -3,13 +3,13 @@ I strongly recommend using poedit (http://poedit.sourceforge.net) for making new translations, it will save you a lot of manual editing and helps you keep your translation up to date with fuzzy/untranslated messages highlighting -and more. Future versions of xmule2-ui-wx might include a stripped version +and more. Future versions of wxInterface might include a stripped version of poedit. 1. Go to lang/ subdir, and rename the file 'empty.po' to the language of your choice. 2. Use poedit to add the translated strings to it and save it. -3. Go to xmule2-ui-wx Preferences - Add New Language. Enter the name of your +3. Go to wxInterface Preferences - Add New Language. Enter the name of your file there, and restart the interface to test your new translation. Alternativly, if you do not have access to poedit (seems it is not available |
From: <ma...@us...> - 2003-11-20 01:28:09
|
Update of /cvsroot/sharedaemon/ui-wx/doc In directory sc8-pr-cvs1:/tmp/cvs-serv31500/doc Modified Files: Source Log Message: Renamed xMule* files to wxInterface*, renamed xMuleGUI class to wxInterface, xMuleDlg to CMainFrame and changed all xmule2 stuff in source to wxInterface. Index: Source =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/doc/Source,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Source 6 Sep 2003 12:14:23 -0000 1.8 +++ Source 20 Nov 2003 01:27:26 -0000 1.9 @@ -1,8 +1,8 @@ Source Code Documentation ************************* -Most dialog controls are in xMuleGUI_wdr.cpp file, which is generated by -wxDesigner. To make modifications, you need to open the file xMuleGUI.wdr +Most dialog controls are in wxInterface_wdr.cpp file, which is generated by +wxDesigner. To make modifications, you need to open the file wxInterface.wdr with wxDesigner and export c++ code. Most icons are also in the same file, make modifications with wxDesigner in the Bitmap Lists section. @@ -43,12 +43,12 @@ We use CMListCtrl class (derived from wxListCtrl) for list controls to keep common events and methods in same place. -* xMuleGUI class +* wxInterface class This class is the topmost class in the class hierarchy. This is called - on application startup and it creates the main dialog frame xMuleDlg. + on application startup and it creates the main dialog frame MainDlg. Any possible command arguments are also handled here. -* xMuleDlg class +* MainDlg class This class handles the main dialog functions, such as Toolbar and Statusbar. Also, displaying any additional dialog pages such as Server page, Search page etc are called from here. @@ -59,7 +59,7 @@ Few hints on hacking the source: * To add a dialog control: - First open the xMuleGUI.wdr file in wxDesigner, and see if your dialog + First open the wxInterface.wdr file in wxDesigner, and see if your dialog is in there. If yes, you'r lucky - refer to wxDesigner documentation on further information. @@ -77,12 +77,12 @@ columns count (this should be automated at some point). * To add toolbar button: - Go to xMuleDlg.cpp, function CreateMyToolBar(), and add your button + Go to MainDlg.cpp, function CreateMyToolBar(), and add your button there. Then also add an event handler for your new button, and a function to handle that event. * To change images (any): - Most images are (at current point) stored in xMuleGUI_wdr.cpp file + Most images are (at current point) stored in wxInterface_wdr.cpp file which is generated by wxDesigner - use wxDesigner to add your image. But I'm working on removing all images from the file and moving them to src/images/default dir to make image changing easier and allow |
From: <ma...@us...> - 2003-11-19 23:22:59
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv10595/src Modified Files: ServerWnd.cpp ServerWnd.h xMuleGUI_wdr.cpp xMuleGUI.wdr Added Files: SBPanel.cpp SBPanel.h Log Message: Reimplemented SideBar in a dynamic manner. --- NEW FILE: SBPanel.cpp --- /* * This file is part of xMule2. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * 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 */ #ifdef __GNUG__ #pragma implementation "SBPanel.cpp" #endif // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #include "SBPanel.h" /** * CSBPanel class */ BEGIN_EVENT_TABLE(CSBPanel, wxPanel) EVT_BUTTON(-1, CSBPanel::Toggle) END_EVENT_TABLE() /** * Constructor for CSBPanel object. We create a Static Box inside this panel * and a "headerbutton" which will then provide us with toggling functionality. */ CSBPanel::CSBPanel( wxWindow *parent, wxWindowID id, const wxString &title, const wxString &name ) : wxPanel( parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, name) { wxStaticBox *box = new wxStaticBox(this, -1, wxT("")); mainsizer = new wxStaticBoxSizer(box, wxVERTICAL); headerbtn = new wxButton( this, -1, title, wxDefaultPosition, wxDefaultSize, 0 ); headerbtn->SetFont( wxFont( 12, wxROMAN, wxNORMAL, wxBOLD ) ); mainsizer->Add( headerbtn, 0, wxGROW, 5 ); SetAutoLayout(true); SetSizer(mainsizer); mainsizer->Fit(this); mainsizer->SetSizeHints(this); } CSBPanel::~CSBPanel() { m_config->Write( wxT("/")+GetParent()->GetName()+wxT("/")+GetName(), content->IsShown() ); } /** * Toggle method provides functionality for showing/hiding the contents * of this panel. First we check that the triggered event actually belongs * to our toggler-button. If so, we Hide the content, and call Fit() and * Layout() as neccesery. */ void CSBPanel::Toggle(wxCommandEvent &event) { if (event.GetId() != headerbtn->GetId()) { event.Skip(); return; } if (content->IsShown()) { mainsizer->Hide(content); content->Hide(); } else { mainsizer->Show(content); content->Show(); } mainsizer->SetMinSize(GetParent()->GetSize().GetWidth()-5, -1); mainsizer->Fit(this); GetParent()->GetSizer()->Layout(); ::wxGetTopLevelParent(this)->Layout(); } /** * This method adds contents (a panel) into the section. We store * the pointer to the content panel locally for easier access. * If there is any existing content in CSBPAnel, it is removed. * And last, read from config under section /ParentWindowName/SectionName * if the new section should be shown or not (default: true) */ void CSBPanel::SetContent(wxPanel *data) { bool shown; if (content) { mainsizer->Remove(content); } content = data; mainsizer->Add(content, 0, wxGROW|wxALL, 5); mainsizer->Fit(this); mainsizer->Layout(); m_config->Read( wxT("/")+GetParent()->GetName()+wxT("/")+GetName(), &shown, true ); if (!shown) { /** * We create an empty event with headerbtn ID and send it to * Toggle, since Toggle doesn't accept events with any other IDs */ wxCommandEvent nullevent; nullevent.SetId(headerbtn->GetId()); Toggle(nullevent); } } --- NEW FILE: SBPanel.h --- /* * This file is part of xMule2. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * 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 __SBPanel_H__ #define __SBPanel_H__ #ifdef __GNUG__ #pragma interface "SBPanel.cpp" #endif #include "wx/wxprec.h" #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "defines.h" /** * SBPanel, or SideBar Panel is a panel with a button on top of it * that provides its "closing" and "opening" functionality. * Usage: * Create new CSBPanel object and call SetContent(wxPanel *data) to * populate the panel with contents. You CAN NOT set two contents to * one section, but calling SetContent() at later time will replace * current contents with new contents. */ class CSBPanel : public wxPanel { public: CSBPanel( wxWindow *parent, wxWindowID id, const wxString &title, const wxString &name ); virtual ~CSBPanel(); void SetContent(wxPanel *data); void Toggle(wxCommandEvent &event); private: DECLARE_EVENT_TABLE(); wxStaticBoxSizer *mainsizer; wxPanel *content; wxButton *headerbtn; bool shown; }; #endif Index: ServerWnd.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/ServerWnd.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- ServerWnd.cpp 17 Nov 2003 03:59:54 -0000 1.35 +++ ServerWnd.cpp 19 Nov 2003 23:22:07 -0000 1.36 @@ -38,20 +38,6 @@ BEGIN_EVENT_TABLE(CServerWnd,wxPanel) EVT_BUTTON(ID_BTN_TOGGLE_SIDEBAR, CServerWnd::ToggleSidebar) - EVT_BUTTON(ID_BTN_SHOW_ADDSERVER, CServerWnd::ToggleAddServerPanel) - EVT_BUTTON(ID_BTN_SHOW_UPDATELIST, CServerWnd::ToggleUpdateServerPanel) - EVT_BUTTON( - ID_BTN_SHOW_SERVERSETTINGS, - CServerWnd::ToggleServerSettingsPanel - ) - EVT_BUTTON( - ID_BTN_SHOW_PORT_OPTIONS, - CServerWnd::TogglePortSettingsPanel - ) - EVT_BUTTON( - ID_BTN_SHOW_LOGGINGOPTIONS, - CServerWnd::ToggleLogOptionsPanel - ) EVT_BUTTON(ID_ADDTOLIST, CServerWnd::AddNewServer) EVT_BUTTON(ID_UPDATE, CServerWnd::UpdateFromURL) EVT_SIZE(CServerWnd::OnSize) @@ -73,7 +59,9 @@ * Read SideBar value from config object, and if it * returns false, toggle (hide) the sidebar. */ - m_config->Read(wxT("/ServerWnd/SideBar"), &show_sidebar, true); + m_config->Read( + wxT("/ServerWnd/SideBar"), &show_sidebar, true + ); if (!show_sidebar) { wxCommandEvent null_event; ToggleSidebar(null_event); @@ -112,19 +100,6 @@ } m_config->Write(wxT("SideBar"), sidebar->IsShown()); - m_config->Write(wxT("SideBar_AddServer"), addserverpanel->IsShown()); - m_config->Write(wxT("SideBar_UpdateServer"), - updateserverpanel->IsShown() - ); - m_config->Write(wxT("SideBar_ServerSettings"), - settingspanel->IsShown() - ); - m_config->Write(wxT("SideBar_PortSettings"), - portsettingspanel->IsShown() - ); - m_config->Write(wxT("SideBar_LoggingOptions"), - logoptionspanel->IsShown() - ); } /** @@ -179,90 +154,79 @@ /* Creates server page controls */ void CServerWnd::CreateControls() { int horizontal_splitter_pos; - bool show_addserver, show_updateserver, show_serversettings, - show_portsettings, show_logoptions; - wxString closed; - /* Flexgridsizer with two columns, second of them being growable. */ + /* Flexgridsizer with three columns, third of them being growable. */ mainsizer = new wxFlexGridSizer(3); mainsizer->AddGrowableCol( 2 ); mainsizer->AddGrowableRow( 0 ); - /* First add the sidebar, its going to be the left-most control. */ + + /** + * First add the sidebar, its going to be the left-most control. + * Altough the name of the panel is never displayed, it is used + * for saving its settings into config file, DONT MODIFY/DELETE it. + */ sidebar = new wxPanel( this, -1, wxDefaultPosition, wxDefaultSize, - wxNO_FULL_REPAINT_ON_RESIZE); - Server_Sidebar(sidebar, true, true); - mainsizer->Add(sidebar, 0, wxGROW|wxTOP|wxBOTTOM, 5); - - /* Create sidebar panels */ - addserverpanel = new wxPanel(sidebar); - updateserverpanel = new wxPanel(sidebar); - settingspanel = new wxPanel(sidebar); - portsettingspanel = new wxPanel(sidebar); - logoptionspanel = new wxPanel(sidebar); + wxNO_FULL_REPAINT_ON_RESIZE|wxGROW, wxT("ServerWnd") + ); + /* Sidebar panel needs a sizer also for managing its children. */ + wxFlexGridSizer *sbmain = new wxFlexGridSizer(1, 0, 0); + sbmain->AddGrowableCol(0); - /* Insert content into them */ - Server_AddServerPanel(addserverpanel, true, true); - Server_UpdatePanel(updateserverpanel, true, true); - Server_SettingsPanel(settingspanel, true, true); - Server_PortSettingsPanel(portsettingspanel, true, true); - Server_LogOptionsPanel(logoptionspanel, true, true); + sidebar->SetSizer(sbmain); + sidebar->SetAutoLayout(true); + sbmain->Fit(sidebar); + sbmain->SetSizeHints(sidebar); - /* Set button labels */ - closed = wxT(" >>"); - GetBtnToggleAddServer()->SetLabel(_("Add a server") + closed); - GetBtnToggleUpdateServer()->SetLabel(_("Update from URL") + closed); - GetBtnToggleServerSettings()->SetLabel(_("Server settings") + closed); - GetBtnTogglePortSettings()->SetLabel(_("Port settings") + closed); - GetBtnToggleLogOptions()->SetLabel(_("Logging options") + closed); - - /* Hide all of them */ - addserverpanel->Hide(); - updateserverpanel->Hide(); - settingspanel->Hide(); - portsettingspanel->Hide(); - logoptionspanel->Hide(); + /* Add the sidebar to mainsizer. */ + mainsizer->Add(sidebar, 0, wxGROW|wxTOP|wxBOTTOM|wxADJUST_MINSIZE, 5); - /* Read from config object which ones should be shown */ - m_config->Read( - wxT("/ServerWnd/SideBar_AddServer"), - &show_addserver, false - ); - m_config->Read( - wxT("/ServerWnd/SideBar_UpdateServer"), - &show_updateserver, false + /** + * Create new CSBPanel object which provides framework for + * opening/closing the section. Then create a new panel to store + * the contents of the section, and attach it to CSBPanel. + * Finally, append the CSBPanel to our sidebar panel. + */ + CSBPanel *addserver = new CSBPanel( + sidebar, -1, _("Add new server"), wxT("SideBar_AddServer") ); - m_config->Read( - wxT("/ServerWnd/SideBar_ServerSettings"), - &show_serversettings, true + wxPanel *addserver_cnt = new wxPanel(addserver, -1); + Server_AddServerPanel(addserver_cnt); + addserver->SetContent(addserver_cnt); + sbmain->Add(addserver, 0, wxGROW|wxALL|wxADJUST_MINSIZE, 0); + + CSBPanel *updatelist = new CSBPanel( + sidebar, -1, _("Update from URL"), wxT("SideBar_UpdateServer") ); - m_config->Read( - wxT("/ServerWnd/SideBar_PortSettings"), - &show_portsettings, false + wxPanel *updatelist_cnt = new wxPanel(updatelist, -1); + Server_UpdatePanel(updatelist_cnt); + updatelist->SetContent(updatelist_cnt); + sbmain->Add(updatelist, 0, wxGROW|wxALL|wxADJUST_MINSIZE, 0); + + CSBPanel *serversettings = new CSBPanel( + sidebar, -1, _("Server settings"), wxT("SideBar_ServerSettings") ); - m_config->Read( - wxT("/ServerWnd/SideBar_LoggingOptions"), - &show_logoptions, true + wxPanel *serversettings_cnt = new wxPanel(serversettings, -1); + Server_SettingsPanel(serversettings_cnt); + serversettings->SetContent(serversettings_cnt); + sbmain->Add(serversettings, 0, wxGROW|wxALL|wxADJUST_MINSIZE, 0); + + CSBPanel *portsettings = new CSBPanel( + sidebar, -1, _("Port settings"), wxT("SideBar_PortSettings") ); + wxPanel *portsettings_cnt = new wxPanel(portsettings, -1); + Server_PortSettingsPanel(portsettings_cnt); + portsettings->SetContent(portsettings_cnt); + sbmain->Add(portsettings, 0, wxGROW|wxALL|wxADJUST_MINSIZE, 0); - /* Call Toggle methods with null event as needed */ - wxCommandEvent null_event; - if (show_addserver) { - ToggleAddServerPanel(null_event); - } - if (show_updateserver) { - ToggleUpdateServerPanel(null_event); - } - if (show_serversettings) { - ToggleServerSettingsPanel(null_event); - } - if (show_portsettings) { - TogglePortSettingsPanel(null_event); - } - if (show_logoptions) { - ToggleLogOptionsPanel(null_event); - } + CSBPanel *logoptions = new CSBPanel( + sidebar, -1, _("Log options"), wxT("SideBar_LoggingOptions") + ); + wxPanel *logoptions_cnt = new wxPanel(logoptions, -1); + Server_LogOptionsPanel(logoptions_cnt); + logoptions->SetContent(logoptions_cnt); + sbmain->Add(logoptions, 0, wxGROW|wxALL|wxADJUST_MINSIZE, 0); /** * Bitmap button between sidebar and splitter @@ -273,7 +237,7 @@ wxDefaultPosition, wxSize(10,100) ); mainsizer->Add(toggler, 0, wxALIGN_CENTER, 5 ); - + /* Read splitter positions from configuration object. */ m_config->Read(wxT("/ServerWnd/Horizontal_Splitter"), &horizontal_splitter_pos, 400); @@ -309,116 +273,10 @@ } /** - * These 4 methods toggle the displayment of sidebar panels by determining - * wether its shown or not by call to IsShown(), and then either removing - * it from sizer and hiding it, or attaching it to sizer and showing it. - * Layout() is needed to recalculate item positions, and Refresh() to - * avoid strange GUI bugs. - */ -void CServerWnd::ToggleAddServerPanel(wxCommandEvent &event) { - wxString addserver; - - addserver = _("Add a server"); - - if (addserverpanel->IsShown()) { - sizer_addserver->Remove(addserverpanel); - addserverpanel->Hide(); - GetBtnToggleAddServer()->SetLabel(addserver+wxT(" >>")); - } else { - sizer_addserver->Add(addserverpanel, 0, wxGROW, 0); - addserverpanel->Show(); - GetBtnToggleAddServer()->SetLabel(addserver+wxT(" <<")); - } - - sidebar->Layout(); - sidebar->Refresh(); -} - -void CServerWnd::ToggleUpdateServerPanel(wxCommandEvent &event) { - wxString updateurl; - - updateurl = _("Update from URL"); - - if (updateserverpanel->IsShown()) { - sizer_updateserver->Remove(updateserverpanel); - updateserverpanel->Hide(); - GetBtnToggleUpdateServer()->SetLabel(updateurl+wxT(" >>")); - } else { - sizer_updateserver->Add(updateserverpanel, 0, wxGROW, 0); - updateserverpanel->Show(); - GetBtnToggleUpdateServer()->SetLabel(updateurl+wxT(" <<")); - } - - sidebar->Layout(); - sidebar->Refresh(); -} - -void CServerWnd::ToggleServerSettingsPanel(wxCommandEvent &event) { - wxString serversettings; - - serversettings = _("Server settings"); - - if (settingspanel->IsShown()) { - sizer_serversettings->Remove(settingspanel); - settingspanel->Hide(); - GetBtnToggleServerSettings()->SetLabel( - serversettings+wxT(" >>") - ); - } else { - sizer_serversettings->Add(settingspanel, 0, wxGROW, 0); - settingspanel->Show(); - GetBtnToggleServerSettings()->SetLabel( - serversettings+wxT(" <<") - ); - } - - sidebar->Layout(); - sidebar->Refresh(); -} - -void CServerWnd::TogglePortSettingsPanel(wxCommandEvent &event) { - wxString portsettings; - - portsettings = _("Port settings"); - - if (portsettingspanel->IsShown()) { - sizer_portsettings->Remove(portsettingspanel); - portsettingspanel->Hide(); - GetBtnTogglePortSettings()->SetLabel(portsettings+wxT(" >>")); - } else { - sizer_portsettings->Add(portsettingspanel, 0, wxGROW, 0); - portsettingspanel->Show(); - GetBtnTogglePortSettings()->SetLabel(portsettings+wxT(" <<")); - } - - sidebar->Layout(); - sidebar->Refresh(); -} - -void CServerWnd::ToggleLogOptionsPanel(wxCommandEvent &event) { - wxString loggingoptions; - - loggingoptions = _("Logging options"); - - if (logoptionspanel->IsShown()) { - sizer_logoptions->Remove(logoptionspanel); - logoptionspanel->Hide(); - GetBtnToggleLogOptions()->SetLabel(loggingoptions+wxT(" >>")); - } else { - sizer_logoptions->Add(logoptionspanel, 0, wxGROW, 0); - logoptionspanel->Show(); - GetBtnToggleLogOptions()->SetLabel(loggingoptions+wxT(" <<")); - } - - sidebar->Layout(); - sidebar->Refresh(); -} - -/** * Toggles the displayment of sidebar. * This code part requires a patched version of wxWindows that has - * wxFlexGridSizer::RemoveGrowableCol() method implemented (2.4.1 doesn't - * have it, and CVS doesn't have it either as of 2003/09/04). + * wxFlexGridSizer::RemoveGrowableCol() method implemented (only + wxWindows CVS HEAD has this implemented as of 2003-11-19). */ void CServerWnd::ToggleSidebar(wxCommandEvent &event) { #ifdef __HAVE_REMOVE_GROWABLE_COL__ @@ -431,7 +289,7 @@ GetBtnToggleSidebar()->SetBitmapSelected(img->rightarrow); GetBtnToggleSidebar()->SetBitmapFocus(img->rightarrow); } else { - mainsizer->Prepend(sidebar, 0, wxGROW|wxTOP|wxBOTTOM, 5); + mainsizer->Prepend(sidebar, 0, wxGROW|wxTOP|wxBOTTOM|wxADJUST_MINSIZE, 5); mainsizer->RemoveGrowableCol(1); mainsizer->AddGrowableCol(2); sidebar->Show(); Index: ServerWnd.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/ServerWnd.h,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- ServerWnd.h 17 Nov 2003 03:59:54 -0000 1.24 +++ ServerWnd.h 19 Nov 2003 23:22:07 -0000 1.25 @@ -36,6 +36,7 @@ #include "defines.h" #include "ServerListCtrl.h" #include "xMuleDlg.h" +#include "SBPanel.h" /* * CServerWnd class. @@ -63,11 +64,6 @@ DECLARE_EVENT_TABLE() /* Member event handlers */ void ToggleSidebar(wxCommandEvent &event); - void ToggleAddServerPanel(wxCommandEvent &event); - void ToggleUpdateServerPanel(wxCommandEvent &event); - void ToggleServerSettingsPanel(wxCommandEvent &event); - void TogglePortSettingsPanel(wxCommandEvent &event); - void ToggleLogOptionsPanel(wxCommandEvent &event); /* Member function declarations */ void AddNewServer(); @@ -79,9 +75,6 @@ /* Sidebar and its panels */ wxPanel *sidebar; - wxPanel *addserverpanel, *updateserverpanel, - *settingspanel, *portsettingspanel, - *logoptionspanel; /* Splitter window and its panels */ wxPanel *top_panel, *bottom_panel; @@ -125,26 +118,11 @@ wxStaticBitmap* GetServerListImage() { return (wxStaticBitmap*) FindWindow(ID_SERVERS_IMAGE); } - wxStaticBitmap* GetSSBitmapProvider() { - return (wxStaticBitmap*) FindWindow(ID_SS_SERVER_IMG); - } - wxButton* GetBtnToggleAddServer() { - return (wxButton*) FindWindow(ID_BTN_SHOW_ADDSERVER); - } - wxButton* GetBtnToggleUpdateServer() { - return (wxButton*) FindWindow(ID_BTN_SHOW_UPDATELIST); - } - wxButton* GetBtnToggleServerSettings() { - return (wxButton*) FindWindow(ID_BTN_SHOW_SERVERSETTINGS); - } - wxButton* GetBtnTogglePortSettings() { - return (wxButton*) FindWindow(ID_BTN_SHOW_PORT_OPTIONS); - } - wxButton* GetBtnToggleLogOptions() { - return (wxButton*) FindWindow(ID_BTN_SHOW_LOGGINGOPTIONS); - } wxBitmapButton* GetBtnToggleSidebar() { return (wxBitmapButton*) FindWindow(ID_BTN_TOGGLE_SIDEBAR); + } + wxStaticBitmap* GetSSBitmapProvider() { + return (wxStaticBitmap*) FindWindow(ID_SS_SERVER_IMG); } wxStaticText* GetSSServerName() { return (wxStaticText*) FindWindow(ID_SS_SERVER_NAME); Index: xMuleGUI_wdr.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/xMuleGUI_wdr.cpp,v retrieving revision 1.105 retrieving revision 1.106 diff -u -d -r1.105 -r1.106 --- xMuleGUI_wdr.cpp 17 Nov 2003 22:32:13 -0000 1.105 +++ xMuleGUI_wdr.cpp 19 Nov 2003 23:22:07 -0000 1.106 @@ -1064,7 +1064,7 @@ wxButton *item6 = new wxButton( parent, ID_ADDTOLIST, _("Add to List"), wxDefaultPosition, wxDefaultSize, 0 ); item6->SetToolTip( _("Add the server to list") ); - item0->Add( item6, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); + item0->Add( item6, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 ); if (set_sizer) { @@ -1089,7 +1089,7 @@ item0->Add( item1, 0, wxGROW, 5 ); wxButton *item2 = new wxButton( parent, ID_UPDATE, _("Update"), wxDefaultPosition, wxDefaultSize, 0 ); - item0->Add( item2, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT|wxBOTTOM, 5 ); + item0->Add( item2, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT|wxTOP, 5 ); if (set_sizer) { @@ -1157,7 +1157,7 @@ }; wxChoice *item13 = new wxChoice( parent, ID_SS_PRIO, wxDefaultPosition, wxSize(80,-1), 3, strs13, 0 ); item13->SetToolTip( _("Change server priority") ); - item11->Add( item13, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxBOTTOM, 5 ); + item11->Add( item13, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); item8->Add( item11, 0, wxALIGN_CENTER, 5 ); Index: xMuleGUI.wdr =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/xMuleGUI.wdr,v retrieving revision 1.103 retrieving revision 1.104 diff -u -d -r1.103 -r1.104 Binary files /tmp/cvsQjrRGi and /tmp/cvsygBujt differ |
From: <ma...@us...> - 2003-11-19 23:22:58
|
Update of /cvsroot/sharedaemon/ui-wx In directory sc8-pr-cvs1:/tmp/cvs-serv10595 Modified Files: Changelog Log Message: Reimplemented SideBar in a dynamic manner. Index: Changelog =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/Changelog,v retrieving revision 1.86 retrieving revision 1.87 diff -u -d -r1.86 -r1.87 --- Changelog 17 Nov 2003 21:41:27 -0000 1.86 +++ Changelog 19 Nov 2003 23:22:07 -0000 1.87 @@ -2,6 +2,9 @@ |Changelog for xmule2-ui-wx | ----------------------------- +2003/11/20 Alo Sarv + * Reimplemented SideBar in a dynamic manner. + 2003/11/17 Alo Sarv * FIXED: Win32 compatibility issues * Tooltips for all Server page Sidebar and GUI Settings Dialog controls. |
From: <ma...@us...> - 2003-11-19 03:23:22
|
Update of /cvsroot/sharedaemon/CVSROOT In directory sc8-pr-cvs1:/tmp/cvs-serv7252 Modified Files: commitinfo checkoutlist Added Files: avail Log Message: CVS read/write access right script. --- NEW FILE: avail --- unavail avail|madcat_ avail|bothie avail|mikaelbarbeaux Index: commitinfo =================================================================== RCS file: /cvsroot/sharedaemon/CVSROOT/commitinfo,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- commitinfo 17 Nov 2003 14:13:07 -0000 1.1 +++ commitinfo 19 Nov 2003 03:23:19 -0000 1.2 @@ -13,3 +13,4 @@ # # If the name "ALL" appears as a regular expression it is always used # in addition to the first matching regex or "DEFAULT". +ALL /cvsroot/sitedocs/CVSROOT/cvstools/cvs_acls Index: checkoutlist =================================================================== RCS file: /cvsroot/sharedaemon/CVSROOT/checkoutlist,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- checkoutlist 17 Nov 2003 14:13:07 -0000 1.1 +++ checkoutlist 19 Nov 2003 03:23:19 -0000 1.2 @@ -11,3 +11,4 @@ # [<whitespace>]<filename><whitespace><error message><end-of-line> # # comment lines begin with '#' +avail |