jetrix-cvs Mailing List for Jetrix TetriNET Server (Page 2)
Brought to you by:
smanux
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(47) |
Dec
(39) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(11) |
Feb
(34) |
Mar
(52) |
Apr
(79) |
May
(14) |
Jun
(41) |
Jul
(19) |
Aug
(44) |
Sep
(36) |
Oct
(36) |
Nov
(6) |
Dec
(58) |
2004 |
Jan
(23) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(91) |
2005 |
Jan
(137) |
Feb
(10) |
Mar
(2) |
Apr
(41) |
May
(62) |
Jun
(9) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(10) |
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(39) |
Sep
(18) |
Oct
|
Nov
(9) |
Dec
|
2009 |
Jan
|
Feb
(27) |
Mar
(4) |
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2010 |
Jan
(3) |
Feb
(14) |
Mar
(3) |
Apr
(10) |
May
(15) |
Jun
|
Jul
|
Aug
(9) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <sm...@us...> - 2010-05-04 10:10:34
|
Revision: 850 http://jetrix.svn.sourceforge.net/jetrix/?rev=850&view=rev Author: smanux Date: 2010-05-04 10:10:28 +0000 (Tue, 04 May 2010) Log Message: ----------- Refreshed the web site Modified Paths: -------------- jetrix/trunk/src/site/features.php jetrix/trunk/src/site/footer.inc.php jetrix/trunk/src/site/header.inc.php jetrix/trunk/src/site/javadoc.php jetrix/trunk/src/site/menu.inc.php jetrix/trunk/src/site/roadmap.php jetrix/trunk/src/site/style.css Modified: jetrix/trunk/src/site/features.php =================================================================== --- jetrix/trunk/src/site/features.php 2010-05-04 10:04:41 UTC (rev 849) +++ jetrix/trunk/src/site/features.php 2010-05-04 10:10:28 UTC (rev 850) @@ -2,6 +2,7 @@ <h1>Features</h1> +<div style="float: right; margin-right: 2em; margin-top: 1em"> <b>Legend:</b> <ul> @@ -9,29 +10,29 @@ <li class="planned">planned</li> <li class="partial">in progress</li> </ul> +</div> - <h2>Server</h2> <ul> - <li class="done"> multiple channels</li> + <li class="done"> Multiple channels</li> <li class="done"> 31 commands (<a href="user-guide.php#section4">reference</a>)</li> - <li class="done"> partial command invocation (<tt>/j</tt> for <tt>/join</tt>, <tt>/br</tt> for <tt>/broadcast</tt>, etc...)</li> - <li class="done"> password protected channels</li> - <li class="done"> authentication level restricted channels</li> - <li class="done"> pluggable command system (<a href="dev-guide.php#section3-1">create your own /commands</a>)</li> - <li class="done"> customizable winlists</li> - <li class="done"> unlimited spectators per channel</li> - <li class="planned"> database integration</li> + <li class="done"> Partial command invocation (<tt>/j</tt> for <tt>/join</tt>, <tt>/br</tt> for <tt>/broadcast</tt>, etc...)</li> + <li class="done"> Password protected channels</li> + <li class="done"> Authentication level restricted channels</li> + <li class="done"> Pluggable command system (<a href="dev-guide.php#section3-1">create your own /commands</a>)</li> + <li class="done"> Customizable winlists</li> + <li class="done"> Unlimited spectators per channel</li> + <li class="done"> Database integration</li> <li class="partial"> 100 simultaneous clients supported</li> - <li class="done"> customizable channels with <a href="dev-guide.php#section3-2">filters</a></li> - <li class="done"> run on multiple platforms (tested on Linux, Windows & Solaris)</li> + <li class="done"> Customizable channels with <a href="dev-guide.php#section3-2">filters</a></li> + <li class="done"> Run on multiple platforms (tested on Linux, Windows & Solaris)</li> </ul> <h2>Clients & Protocols</h2> <ul> - <li class="done"> multiple clients & protocols supported</li> + <li class="done"> Multiple clients & protocols supported</li> <li class="done"> TetriNET clients</li> <li class="done"> TetriFast clients</li> <li class="done"> Block synchronization protocol (1.14)</li> @@ -44,24 +45,24 @@ <h2>Gaming</h2> <ul> - <li class="done"> game statistics (dropping rate, specials used, tetris...)</li> - <li class="planned"> individual statistics (games played, average skill, time logged, time played...)</li> - <li class="planned"> game recording and playback</li> - <li class="done"> multiplayer "7Tetris" channel</li> - <li class="planned"> puzzle channels</li> - <li class="done"> survival channel</li> - <li class="planned"> quick channel</li> - <li class="planned"> "all around" channel</li> - <li class="done"> sudden death</li> + <li class="done"> Game statistics (dropping rate, specials used, tetris...)</li> + <li class="planned"> Individual statistics (games played, average skill, time logged, time played...)</li> + <li class="planned"> Game recording and playback</li> + <li class="done"> Multiplayer "7Tetris" channel</li> + <li class="done"> Puzzle channels</li> + <li class="done"> Survival channel</li> + <li class="planned"> Quick channel</li> + <li class="planned"> "All around" channel</li> + <li class="done"> Sudden death</li> </ul> <h2>Anti cheating</h2> <ul> - <li class="done"> specials blocked in pure mode</li> - <li class="planned"> piece droppping rate control</li> - <li class="planned"> forged messages detection</li> - <li class="planned"> block early "add to all" messages</li> + <li class="done"> Specials blocked in pure mode</li> + <li class="planned"> Piece droppping rate control</li> + <li class="planned"> Forged messages detection</li> + <li class="planned"> Block early "add to all" messages</li> </ul> <h2>Chatting</h2> @@ -77,17 +78,17 @@ <h2>Administration</h2> <ul> - <li class="partial"> web administration console</li> + <li class="partial"> Web administration console</li> <li class="done"> XML based configuration files</li> - <li class="partial"> hot reconfiguration (no server restart needed)</li> - <li class="partial"> administration from the system shell</li> + <li class="partial"> Hot reconfiguration (no server restart needed)</li> + <li class="partial"> Administration from the system shell</li> </ul> <h2>Internationalization</h2> <ul> - <li class="done"> support for multiple languages</li> - <li class="planned"> language detection based on client's IP</li> + <li class="done"> Support for multiple languages</li> + <li class="planned"> Language detection based on client's IP</li> <li class="done"> English support</li> <li class="done"> French support</li> <li class="done"> German support</li> @@ -100,29 +101,32 @@ <h2>Security</h2> <ul> - <li class="planned"> player authentication</li> - <li class="planned"> pluggable authentication modules (support for LDAP, Unix, NT or custom authentication systems)</li> - <li class="done"> limitation on simultaneous connections from the same host (default to 3)</li> - <li class="planned"> connection frequency check</li> - <li class="done"> host ban list</li> - <li class="planned"> host allow list</li> + <li class="planned"> Player authentication</li> + <li class="planned"> Pluggable authentication modules (support for LDAP, Unix, NT or custom authentication systems)</li> + <li class="done"> Limitation on simultaneous connections from the same host (default to 3)</li> + <li class="planned"> Connection frequency check</li> + <li class="done"> Host ban list</li> + <li class="planned"> Host allow list</li> </ul> <h2>Networking</h2> <ul> - <li class="done"> IPv6 support (testing needed)</li> + <li class="done"> IPv6 support</li> + <li class="planned"> UPnP support</li> </ul> <h2>Misc</h2> <ul> - <li class="done"> automatic advertisement to server directories (tetrinet.org, tsrv.com)</li> - <li class="partial"> automatic update</li> - <li class="done"> notification of new versions</li> - <li class="planned"> run as a service on Windows</li> - <li class="planned"> run as a daemon on Unix/Linux</li> + <li class="done"> Automatic advertisement to server directories (<a href="http://servers.tetrinet.fr">servers.tetrinet.fr</a>)</li> + <li class="partial"> Automatic update</li> + <li class="done"> Notification of new versions</li> + <li class="planned"> Run as a service on Windows</li> + <li class="planned"> Run as a daemon on Unix/Linux</li> <li class="done"> Windows installer</li> + <li class="done"> Debian package</li> + <li class="planned"> RPM package</li> </ul> <? include("footer.inc.php") ?> Modified: jetrix/trunk/src/site/footer.inc.php =================================================================== --- jetrix/trunk/src/site/footer.inc.php 2010-05-04 10:04:41 UTC (rev 849) +++ jetrix/trunk/src/site/footer.inc.php 2010-05-04 10:10:28 UTC (rev 850) @@ -9,9 +9,9 @@ </td> </tr> <tr> - <td colspan="2"> - <a href="http://validator.w3.org/check/referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a> - <a href="http://jigsaw.w3.org/css-validator/"><img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" /></a> + <td colspan="2" align="right"> + <a href="http://validator.w3.org/check/referer"><img src="images/xhtml10-wide.png" alt="Valid XHTML 1.0!" /></a> + <a href="http://jigsaw.w3.org/css-validator/"><img src="images/css-wide.png" alt="Valid CSS!" /></a> </td> </tr> </tbody> Modified: jetrix/trunk/src/site/header.inc.php =================================================================== --- jetrix/trunk/src/site/header.inc.php 2010-05-04 10:04:41 UTC (rev 849) +++ jetrix/trunk/src/site/header.inc.php 2010-05-04 10:10:28 UTC (rev 850) @@ -46,7 +46,11 @@ <!-- left side menu --> <td style="width: 150px; white-space: nowrap" valign="top"> <? include("menu.inc.php"); ?> - <a href="http://www.opensource.org/"><img src="images/opensource-110x95.png" alt="Open Source" /></a> + + <div align="center"> + <a href="http://www.opensource.org/"><img src="images/opensource-110x95.png" alt="Open Source" /></a><br/> + + <a href='http://www.ohloh.net/stack_entries/new?project_id=jetrix&ref=WidgetProjectUsersLogo' onMouseOut="this.style.background = 'url(http://www.ohloh.net/images/stack/iusethis/static_logo.png) 0px 0px no-repeat'" onMouseOver="this.style.background = 'url(http://www.ohloh.net/images/stack/iusethis/static_logo.png) 0 -23px no-repeat'" style='border-bottom:none;text-decoration:none;display:block;background:url(http://www.ohloh.net/images/stack/iusethis/static_logo.png) 0px 0px no-repeat;width:73px;height:23px;' target='_top' title='Support Jetrix TetriNET Server by adding it to your stack at Ohloh'></a></div> </td> <td align="left" valign="top"> <div class="content"> Modified: jetrix/trunk/src/site/javadoc.php =================================================================== --- jetrix/trunk/src/site/javadoc.php 2010-05-04 10:04:41 UTC (rev 849) +++ jetrix/trunk/src/site/javadoc.php 2010-05-04 10:10:28 UTC (rev 850) @@ -6,7 +6,7 @@ This is the API of the code being actively developped. This API is unstable, use it only if you need the latest features for your developments. This -documentation is generated daily from the CVS HEAD. +documentation is generated daily from the SVN trunk. <p> <a href="/docs/apidocs/index.html">Jetrix TetriNET Server @version@ API</a> Modified: jetrix/trunk/src/site/menu.inc.php =================================================================== --- jetrix/trunk/src/site/menu.inc.php 2010-05-04 10:04:41 UTC (rev 849) +++ jetrix/trunk/src/site/menu.inc.php 2010-05-04 10:10:28 UTC (rev 850) @@ -13,7 +13,7 @@ <ul> <li><a href="http://sourceforge.net/project/showfiles.php?group_id=52188">Binaries</a></li> <li><a href="http://jetrix.svn.sourceforge.net/viewvc/jetrix/">Source Code</a></li> - <li><a href="nightly/">Nightly Build</a></li> + <li><a href="nightly/">Nightly Builds</a></li> </ul> <h1>Documentation</h1> Modified: jetrix/trunk/src/site/roadmap.php =================================================================== --- jetrix/trunk/src/site/roadmap.php 2010-05-04 10:04:41 UTC (rev 849) +++ jetrix/trunk/src/site/roadmap.php 2010-05-04 10:10:28 UTC (rev 850) @@ -7,20 +7,11 @@ to the version 1.0. -<h2>Jetrix 0.2</h2> -<ul> - <li>Feature equivalent to tetrinetx</li> - <li>Services</li> - <li>Sudden death</li> - <li>Dynamic channel creation</li> -</ul> - <h2>Jetrix 0.3</h2> <ul> <li>Database integration</li> <li>Player authentication</li> - <li>Full support of IRC clients</li> <li>Full web administration</li> <li>Friends list</li> </ul> @@ -31,6 +22,7 @@ <li>Player stats</li> <li>Puzzle channels</li> <li>tetrinetx to Jetrix migration tool</li> + <li>Full support of IRC clients</li> </ul> <h2>Jetrix 0.5 (1.0 RC)</h2> @@ -41,4 +33,4 @@ <li>Unix Daemon</li> </ul> -<? include("footer.inc.php") ?> \ No newline at end of file +<? include("footer.inc.php") ?> Modified: jetrix/trunk/src/site/style.css =================================================================== --- jetrix/trunk/src/site/style.css 2010-05-04 10:04:41 UTC (rev 849) +++ jetrix/trunk/src/site/style.css 2010-05-04 10:10:28 UTC (rev 850) @@ -5,9 +5,10 @@ a img { border-width: 0 } .menu { margin-left: 0.5em; } -.menu h1 { font-size: 12pt; font-weight: bold; margin-bottom: 0.2em } +.menu h1 { font-size: 12pt; font-weight: bold; margin-bottom: 0.2em; color: #333333; } .menu ul { padding-left: 0.5em; margin-top: 0; margin-left: 0; } .menu * li { font-size: 9pt; list-style-type: none } +.menu a { text-decoration: none } .content { font-size: 12pt; } .content h1 { color: white; font-size: 13pt; background-color: #525d76; text-indent: 0.5em; line-height: 1.3em; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-05-04 10:04:47
|
Revision: 849 http://jetrix.svn.sourceforge.net/jetrix/?rev=849&view=rev Author: smanux Date: 2010-05-04 10:04:41 +0000 (Tue, 04 May 2010) Log Message: ----------- Updated the deployment task for the web site Modified Paths: -------------- jetrix/trunk/build.xml Modified: jetrix/trunk/build.xml =================================================================== --- jetrix/trunk/build.xml 2010-05-03 20:51:32 UTC (rev 848) +++ jetrix/trunk/build.xml 2010-05-04 10:04:41 UTC (rev 849) @@ -341,13 +341,12 @@ <target name="site" description="Generate and publish the web site to SourceForge"> <!-- Create the site distribution directory --> <mkdir dir="${dist}/site/docs"/> - - <!-- Build the project reports --> + + <!-- Build the project reports with Maven--> <property environment="env"/> - <exec executable="${env.MAVEN2_HOME}/bin/mvn.bat"> - <arg line="site"/> - </exec> - + <exec executable="${env.MVN_HOME}/bin/mvn.bat" osfamily="windows"><arg line="site"/></exec> + <exec executable="mvn" osfamily="unix"><arg line="site"/></exec> + <!-- Copy the project reports --> <copy todir="${dist}/site/docs"> <fileset dir="target/site"/> @@ -387,12 +386,15 @@ <tar destfile="${dist}/site.tar.bz2" compression="bzip2"> <tarfileset dir="${dist}/site"/> </tar> - - <input addproperty="password" message="Password:"/> - - <scp file="${dist}/site.tar.bz2" todir="smanux:${password}@shell.sf.net:/home/users/s/sm/smanux" trust="true"/> - - <sshexec host="shell.sf.net" username="smanux" password="${password}" trust="true" command="tar -jxf site.tar.bz2 --directory=/home/groups/j/je/jetrix/htdocs "/> + + <property name="username" value="smanux,jetrix"/> + <property name="deploy.dir" value="/home/groups/j/je/jetrix"/> + + <input addproperty="password" message="SourceForge Password:"/> + + <scp file="${dist}/site.tar.bz2" todir="${username}:${password}@web.sourceforge.net:${deploy.dir}" trust="true"/> + + <sshexec host="shell.sf.net" username="${username}" password="${password}" trust="true" command="tar -jxf ${deploy.dir}/site.tar.bz2 --directory=${deploy.dir}/htdocs "/> </target> <target name="clean"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-05-03 20:51:39
|
Revision: 848 http://jetrix.svn.sourceforge.net/jetrix/?rev=848&view=rev Author: smanux Date: 2010-05-03 20:51:32 +0000 (Mon, 03 May 2010) Log Message: ----------- Switched the input/output encoding for GTetrinet clients to UTF-8 Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/Protocol.java jetrix/trunk/src/java/net/jetrix/agent/QueryAgent.java jetrix/trunk/src/java/net/jetrix/agent/TetrinetAgent.java jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java jetrix/trunk/src/java/net/jetrix/listeners/TSpecListener.java jetrix/trunk/src/java/net/jetrix/listeners/TetrinetListener.java jetrix/trunk/src/java/net/jetrix/protocols/AbstractProtocol.java jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java Modified: jetrix/trunk/src/java/net/jetrix/Protocol.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/Protocol.java 2010-05-03 18:13:52 UTC (rev 847) +++ jetrix/trunk/src/java/net/jetrix/Protocol.java 2010-05-03 20:51:32 UTC (rev 848) @@ -88,9 +88,10 @@ * * @since 0.3 * - * @param in the stream to be read + * @param in the stream to be read + * @param encoding the charset encoding used to read the message * @throws IOException thrown if the stream is closed */ - String readLine(InputStream in) throws IOException; + String readLine(InputStream in, String encoding) throws IOException; } Modified: jetrix/trunk/src/java/net/jetrix/agent/QueryAgent.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/agent/QueryAgent.java 2010-05-03 18:13:52 UTC (rev 847) +++ jetrix/trunk/src/java/net/jetrix/agent/QueryAgent.java 2010-05-03 20:51:32 UTC (rev 848) @@ -49,6 +49,7 @@ private Socket socket; private InputStream in; private OutputStream out; + private String encoding = "Cp1252"; private Logger log = Logger.getLogger("net.jetrix"); @@ -113,8 +114,8 @@ // read the result QueryProtocol protocol = new QueryProtocol(); - String version = protocol.readLine(in); - protocol.readLine(in); + String version = protocol.readLine(in, encoding); + protocol.readLine(in, encoding); return version; } @@ -129,7 +130,7 @@ // read the result QueryProtocol protocol = new QueryProtocol(); - String line = protocol.readLine(in); + String line = protocol.readLine(in, encoding); if (line.startsWith("Number of players logged in: ")) { @@ -154,7 +155,7 @@ // read the result String line = null; QueryProtocol protocol = new QueryProtocol(); - while (!QueryProtocol.OK.equals(line = protocol.readLine(in))) + while (!QueryProtocol.OK.equals(line = protocol.readLine(in, encoding))) { Matcher matcher = pattern.matcher(line); @@ -197,7 +198,7 @@ // read the result String line = null; QueryProtocol protocol = new QueryProtocol(); - while (!QueryProtocol.OK.equals(line = protocol.readLine(in))) + while (!QueryProtocol.OK.equals(line = protocol.readLine(in, encoding))) { Matcher matcher = pattern.matcher(line); Modified: jetrix/trunk/src/java/net/jetrix/agent/TetrinetAgent.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/agent/TetrinetAgent.java 2010-05-03 18:13:52 UTC (rev 847) +++ jetrix/trunk/src/java/net/jetrix/agent/TetrinetAgent.java 2010-05-03 20:51:32 UTC (rev 848) @@ -65,6 +65,7 @@ private Socket socket; private InputStream in; private Writer out; + private String encoding = "Cp1252"; protected Protocol protocol = new TetrinetProtocol(); private boolean running; @@ -97,12 +98,12 @@ socket.setSoTimeout(15000); in = new BufferedInputStream(socket.getInputStream()); - out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), "ISO-8859-1")); + out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), encoding)); send(TetrinetProtocol.encode(name, version, socket.getInetAddress().getAddress(), false)); // block until the playernum message is received - String line = protocol.readLine(in); + String line = protocol.readLine(in, encoding); Message message = protocol.getMessage(line); receive(message); @@ -132,7 +133,7 @@ { while (running) { - String line = protocol.readLine(in); + String line = protocol.readLine(in, encoding); Message message = protocol.getMessage(line); Modified: jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java 2010-05-03 18:13:52 UTC (rev 847) +++ jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java 2010-05-03 20:51:32 UTC (rev 848) @@ -54,9 +54,11 @@ protected InputStream in; protected OutputStream out; protected Socket socket; + protected String encoding = "Cp1252"; protected ServerConfig serverConfig; + protected BlockingQueue<Message> queue; + protected Logger log = Logger.getLogger("net.jetrix"); - protected BlockingQueue<Message> queue; public TetrinetClient() { @@ -142,6 +144,10 @@ { ClientInfoMessage info = (ClientInfoMessage) message; setVersion(info.getName() + " " + info.getVersion()); + if ("gtetrinet".equalsIgnoreCase(info.getName())) + { + encoding = "UTF-8"; + } } else if (channel != null) { @@ -263,7 +269,7 @@ public Message receive() throws IOException { // read raw message from socket - String line = protocol.readLine(in); + String line = protocol.readLine(in, getEncoding()); lastMessageTime = System.currentTimeMillis(); if (log.isLoggable(Level.FINER)) { @@ -367,7 +373,7 @@ public String getEncoding() { - return "ISO-8859-1"; + return encoding; } public void disconnect() Modified: jetrix/trunk/src/java/net/jetrix/listeners/TSpecListener.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/listeners/TSpecListener.java 2010-05-03 18:13:52 UTC (rev 847) +++ jetrix/trunk/src/java/net/jetrix/listeners/TSpecListener.java 2010-05-03 20:51:32 UTC (rev 848) @@ -47,7 +47,7 @@ public Client getClient(Socket socket) throws Exception { TetrinetProtocol protocol = ProtocolManager.getInstance().getProtocol(TetrinetProtocol.class); - String init = protocol.readLine(socket.getInputStream()); + String init = protocol.readLine(socket.getInputStream(), "Cp1252"); TSpecClient client = new TSpecClient(); client.setProtocol(ProtocolManager.getInstance().getProtocol(TspecProtocol.class)); Modified: jetrix/trunk/src/java/net/jetrix/listeners/TetrinetListener.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/listeners/TetrinetListener.java 2010-05-03 18:13:52 UTC (rev 847) +++ jetrix/trunk/src/java/net/jetrix/listeners/TetrinetListener.java 2010-05-03 20:51:32 UTC (rev 848) @@ -52,7 +52,7 @@ { // read the first line sent by the client Protocol protocol1 = protocolManager.getProtocol(TetrinetProtocol.class); - String init = protocol1.readLine(socket.getInputStream()); + String init = protocol1.readLine(socket.getInputStream(), "Cp1252"); // test if the client is using the query protocol Protocol protocol = protocolManager.getProtocol(QueryProtocol.class); @@ -84,7 +84,7 @@ user.setName(tokens.get(1)); client.setUser(user); - client.setVersion((String) tokens.get(2)); + client.setVersion(tokens.get(2)); if ((tokens.get(0)).equals(TetrinetProtocol.INIT_TOKEN)) { client.setProtocol(protocolManager.getProtocol(TetrinetProtocol.class)); Modified: jetrix/trunk/src/java/net/jetrix/protocols/AbstractProtocol.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/protocols/AbstractProtocol.java 2010-05-03 18:13:52 UTC (rev 847) +++ jetrix/trunk/src/java/net/jetrix/protocols/AbstractProtocol.java 2010-05-03 20:51:32 UTC (rev 848) @@ -80,9 +80,9 @@ return input.toByteArray(); } - public String readLine(InputStream in) throws IOException + public String readLine(InputStream in, String encoding) throws IOException { - return new String(readFrame(in), "Cp1252"); + return new String(readFrame(in), encoding); } public boolean equals(Object o) Modified: jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java =================================================================== --- jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java 2010-05-03 18:13:52 UTC (rev 847) +++ jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java 2010-05-03 20:51:32 UTC (rev 848) @@ -301,7 +301,7 @@ byte[] message = new byte[16 * 1024]; try { - protocol.readLine(new ByteArrayInputStream(message, 0, message.length)); + protocol.readLine(new ByteArrayInputStream(message, 0, message.length), "Cp1252"); fail("No exception raised on a 16K message"); } catch (IOException e) @@ -327,7 +327,7 @@ } return --i; } - }); + }, "Cp1252"); fail("No exception raised on extremely slow input"); } catch (IOException e) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-05-03 18:13:58
|
Revision: 847 http://jetrix.svn.sourceforge.net/jetrix/?rev=847&view=rev Author: smanux Date: 2010-05-03 18:13:52 +0000 (Mon, 03 May 2010) Log Message: ----------- Added two protection mechanisms against potential attacks: - slow clients are rejected to avoid Slowloris-like denial of service - messages over 8K are rejected to avoid filling the server memory Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/protocols/AbstractProtocol.java jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java Modified: jetrix/trunk/src/java/net/jetrix/protocols/AbstractProtocol.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/protocols/AbstractProtocol.java 2010-05-03 15:29:44 UTC (rev 846) +++ jetrix/trunk/src/java/net/jetrix/protocols/AbstractProtocol.java 2010-05-03 18:13:52 UTC (rev 847) @@ -35,19 +35,36 @@ */ public abstract class AbstractProtocol implements Protocol { - public String readLine(InputStream in) throws IOException + /** Maximum size allowed for a message frame. */ + private static final int MAX_SIZE = 8192; + + /** Maximum delay allowed for parsing a message frame (in milliseconds). */ + private static final int MAX_DELAY = 10000; + + /** + * Reads the next message frame from the specified input stream. + * No charset decoding is performed at this stage. + */ + public byte[] readFrame(InputStream in) throws IOException { ByteArrayOutputStream input = new ByteArrayOutputStream(256); - // todo define a maximum line length + long time = 0; int b; - while ((b = in.read()) != -1 && b != getEOL() && b != 0x0A && b != 0x0D) + while ((b = in.read()) != -1 && b != getEOL() && b != 0x0A && b != 0x0D && input.size() < MAX_SIZE) { - if (b != 0x0A && b != 0x0D) + input.write(b); + + if (input.size() == 1) { - input.write(b); + // let's start monitoring the input speed + time = System.currentTimeMillis(); } + else if (System.currentTimeMillis() - time > MAX_DELAY) + { + throw new IOException("Slow input detected (" + input.size() + " bytes over " + (System.currentTimeMillis() - time) + "ms)"); + } } if (b == -1) @@ -55,9 +72,19 @@ throw new IOException("End of stream"); } - return input.toString("ISO-8859-1"); + if (input.size() >= MAX_SIZE) + { + throw new IOException("Message frame exceeded the " + MAX_SIZE + " limit"); + } + + return input.toByteArray(); } + public String readLine(InputStream in) throws IOException + { + return new String(readFrame(in), "Cp1252"); + } + public boolean equals(Object o) { if (this == o) Modified: jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java =================================================================== --- jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java 2010-05-03 15:29:44 UTC (rev 846) +++ jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java 2010-05-03 18:13:52 UTC (rev 847) @@ -21,7 +21,9 @@ import static net.jetrix.protocols.TetrinetProtocol.*; +import java.io.*; import java.util.*; + import junit.framework.*; import net.jetrix.*; import net.jetrix.messages.channel.*; @@ -293,4 +295,44 @@ assertEquals("decoded", "tetrisstart Smanux 1.13", decode(init)); } + + public void testLongMessage() + { + byte[] message = new byte[16 * 1024]; + try + { + protocol.readLine(new ByteArrayInputStream(message, 0, message.length)); + fail("No exception raised on a 16K message"); + } + catch (IOException e) + { + // expected + } + } + + public void testSlowClient() + { + try + { + protocol.readLine(new InputStream() { + int i = 34; + public int read() throws IOException + { + try + { + Thread.sleep(1000); + } + catch (InterruptedException e) + { + } + return --i; + } + }); + fail("No exception raised on extremely slow input"); + } + catch (IOException e) + { + // expected + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-05-03 15:29:50
|
Revision: 846 http://jetrix.svn.sourceforge.net/jetrix/?rev=846&view=rev Author: smanux Date: 2010-05-03 15:29:44 +0000 (Mon, 03 May 2010) Log Message: ----------- Modularization of the resource bundles Modified Paths: -------------- jetrix/trunk/build.xml jetrix/trunk/pom.xml jetrix/trunk/src/java/net/jetrix/Language.java jetrix/trunk/src/java/net/jetrix/commands/ModeCommand.java jetrix/trunk/src/lang/jetrix_en.properties jetrix/trunk/src/lang/jetrix_fr.properties jetrix/trunk/src/lang/jetrix_nl.properties jetrix/trunk/src/lang/jetrix_pt.properties jetrix/trunk/src/test/net/jetrix/LanguageTest.java Added Paths: ----------- jetrix/trunk/src/lang/command/ jetrix/trunk/src/lang/command/mode_en.properties jetrix/trunk/src/lang/command/mode_fr.properties jetrix/trunk/src/lang/command/mode_nl.properties jetrix/trunk/src/lang/command/mode_pt.properties Removed Paths: ------------- jetrix/trunk/src/lang/jetrix.properties Modified: jetrix/trunk/build.xml =================================================================== --- jetrix/trunk/build.xml 2010-05-03 15:12:26 UTC (rev 845) +++ jetrix/trunk/build.xml 2010-05-03 15:29:44 UTC (rev 846) @@ -186,7 +186,7 @@ <include name="lib/jetrix-launcher-${version}.jar" /> </fileset> <fileset dir="${src}"> - <include name="lang/*.properties" /> + <include name="lang/**/*.properties" /> </fileset> </copy> <copy todir="${build}/dist/lib"> Modified: jetrix/trunk/pom.xml =================================================================== --- jetrix/trunk/pom.xml 2010-05-03 15:12:26 UTC (rev 845) +++ jetrix/trunk/pom.xml 2010-05-03 15:29:44 UTC (rev 846) @@ -173,7 +173,7 @@ <directory>src/lang</directory> <targetPath>./</targetPath> <includes> - <include>*.properties</include> + <include>**/*.properties</include> </includes> </testResource> <testResource> Modified: jetrix/trunk/src/java/net/jetrix/Language.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/Language.java 2010-05-03 15:12:26 UTC (rev 845) +++ jetrix/trunk/src/java/net/jetrix/Language.java 2010-05-03 15:29:44 UTC (rev 846) @@ -1,6 +1,6 @@ /** * Jetrix TetriNET Server - * Copyright (C) 2001-2004 Emmanuel Bourg + * Copyright (C) 2001-2004,2010 Emmanuel Bourg * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -30,13 +30,19 @@ */ public class Language { + /** The names of the resource bundles imported. */ + private Set<String> bundleNames = new HashSet<String>(); + + private Map<Locale, MultiResourceBundle> bundles = new HashMap<Locale, MultiResourceBundle>(); + private static Language instance = new Language(); - private Map<Locale,ResourceBundle> bundles; - private static String resource = "jetrix"; + /** The default resource bundle containing the server messages. */ + private static final String DEFAULT_RESOURCE = "jetrix"; + private Language() { - bundles = new HashMap<Locale, ResourceBundle>(); + addResources(DEFAULT_RESOURCE); } /** @@ -48,29 +54,30 @@ } /** + * Register an extra set of localized messages. + * + * @param name the base name of the resource bundle + * @since 0.3 + */ + public void addResources(String name) + { + bundleNames.add(name); + } + + /** * Load and return the <tt>ResourceBundle</tt> for the specified locale. * Bundles are cached in a local Map. * * @param locale the locale of the returned bundle if available */ - public ResourceBundle load(Locale locale) + protected ResourceBundle load(Locale locale) { - ResourceBundle bundle = PropertyResourceBundle.getBundle(resource, locale); + MultiResourceBundle bundle = new MultiResourceBundle(locale); bundles.put(locale, bundle); return bundle; } /** - * Return the <tt>ResourceBundle</tt> for the specified locale. - * - * @param locale the locale of the bundle to return - */ - public ResourceBundle getResourceBundle(Locale locale) - { - return bundles.get(locale); - } - - /** * Tell if the specified locale has a corresponding resource file available. * * @param locale the locale to test @@ -79,12 +86,12 @@ */ public static boolean isSupported(Locale locale) { - ResourceBundle bundle = instance.getResourceBundle(locale); + MultiResourceBundle bundle = instance.bundles.get(locale); if (bundle == null) { - bundle = PropertyResourceBundle.getBundle(resource, locale); + bundle = instance.new MultiResourceBundle(locale); } - return (bundle != null && bundle.getLocale().equals(locale)); + return bundle.isSupported(); } /** @@ -116,7 +123,7 @@ { try { - ResourceBundle bundle = instance.getResourceBundle(locale); + ResourceBundle bundle = instance.bundles.get(locale); if (bundle == null) { bundle = instance.load(locale); @@ -145,18 +152,99 @@ // localize the arguments Object[] arguments2 = new Object[arguments.length]; for (int i = 0; i < arguments.length; i++) + { + arguments2[i] = getLocalizedArgument(locale, arguments[i]); + } + + return MessageFormat.format(getText(key, locale), arguments2); + } + + /** + * Transforms a localized argument into its actual value. Localized + * arguments start with the "key:" prefix and refers to another message + * in the resource bundle. + * + * @since 0.3 + * + * @param locale the target locale + * @param argument the argument to transform + */ + private static Object getLocalizedArgument(Locale locale, Object argument) + { + if (argument instanceof String && ((String) argument).startsWith("key:")) { - if (arguments[i] instanceof String && ((String) arguments[i]).startsWith("key:")) + return getText(((String) argument).substring(4), locale); + } + else + { + return argument; + } + } + + /** + * A resource bundle merging several property based resource bundles. + * + * @since 0.3 + */ + private class MultiResourceBundle extends ResourceBundle + { + private Locale locale; + + private MultiResourceBundle(Locale locale) + { + this.locale = locale; + } + + private PropertyResourceBundle getPropertyResourceBundle(String name) { + try { - arguments2[i] = getText(((String) arguments[i]).substring(4), locale); + return (PropertyResourceBundle) PropertyResourceBundle.getBundle(name, locale); } - else + catch (MissingResourceException e) { - arguments2[i] = arguments[i]; + return null; } } - return MessageFormat.format(getText(key, locale), arguments2); + protected Object handleGetObject(String key) + { + for (String name : bundleNames) + { + PropertyResourceBundle bundle = getPropertyResourceBundle(name); + if (bundle != null) + { + Object value = bundle.handleGetObject(key); + if (value != null) + { + return value; + } + } + } + + return null; + } + + public Enumeration<String> getKeys() + { + return null; + } + + /** + * Checks if at least one of the underlying resource bundles supports + * the locale assigned to this bundle. + */ + public boolean isSupported() + { + for (String name : bundleNames) + { + PropertyResourceBundle bundle = getPropertyResourceBundle(name); + if (bundle != null && bundle.getLocale().equals(locale)) + { + return true; + } + } + + return false; + } } - } Modified: jetrix/trunk/src/java/net/jetrix/commands/ModeCommand.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/commands/ModeCommand.java 2010-05-03 15:12:26 UTC (rev 845) +++ jetrix/trunk/src/java/net/jetrix/commands/ModeCommand.java 2010-05-03 15:29:44 UTC (rev 846) @@ -50,6 +50,11 @@ {0, 0, 0, 0, 0, 0, 100,1, 1} }; + static + { + Language.getInstance().addResources("command.mode"); + } + public String getAlias() { return "mode"; Added: jetrix/trunk/src/lang/command/mode_en.properties =================================================================== --- jetrix/trunk/src/lang/command/mode_en.properties (rev 0) +++ jetrix/trunk/src/lang/command/mode_en.properties 2010-05-03 15:29:44 UTC (rev 846) @@ -0,0 +1,18 @@ +# +# English resource bundle for the /mode command in Jetrix +# +# @author Emmanuel Bourg +# @version $Revision$, $Date$ + +command.mode.description=Change the channel's configuration. +command.mode.message0=PURE 15% sticks +command.mode.message1=COOKIES 1:1 (1 line cleared yields one special block) +command.mode.message2=PURE 20% sticks +command.mode.message3=COOKIE 2:1 (2 lines cleared yield one special block) +command.mode.message4=PURE 25% sticks +command.mode.message5=NO STICKS (0% stick) +command.mode.message6=ALL STICKS (100% stick) +command.mode.message7=COOKIES 1:1 with Z blocks only +command.mode.message8=COOKIES 1:1 with L blocks only +command.mode.message9=COOKIES 1:1 with T blocks only +command.mode.enabled=<gray>Configuration changed to <b>{0}</b> Property changes on: jetrix/trunk/src/lang/command/mode_en.properties ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: jetrix/trunk/src/lang/command/mode_fr.properties =================================================================== --- jetrix/trunk/src/lang/command/mode_fr.properties (rev 0) +++ jetrix/trunk/src/lang/command/mode_fr.properties 2010-05-03 15:29:44 UTC (rev 846) @@ -0,0 +1,18 @@ +# +# French resource bundle for the /mode command in Jetrix +# +# @author Emmanuel Bourg +# @version $Revision$, $Date$ + +command.mode.description=Change la configuration du channel. +command.mode.message0=PURE 15% de lignes +command.mode.message1=COOKIES 1:1 (1 ligne effac\xE9e donne 1 bloc special) +command.mode.message2=PURE 20% de lignes +command.mode.message3=COOKIE 2:1 (2 lignes effac\xE9es donnent 1 bloc sp\xE9cial) +command.mode.message4=PURE 25% de lignes +command.mode.message5=SANS LIGNES (0% lignes) +command.mode.message6=TOUT LIGNES (100% lignes) +command.mode.message7=COOKIES 1:1 avec seulement des blocs Z +command.mode.message8=COOKIES 1:1 avec seulement des blocs L +command.mode.message9=COOKIES 1:1 avec seulement des blocs T +command.mode.enabled=<gray>Configuration chang\xE9e en <b>{0}</b> Property changes on: jetrix/trunk/src/lang/command/mode_fr.properties ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: jetrix/trunk/src/lang/command/mode_nl.properties =================================================================== --- jetrix/trunk/src/lang/command/mode_nl.properties (rev 0) +++ jetrix/trunk/src/lang/command/mode_nl.properties 2010-05-03 15:29:44 UTC (rev 846) @@ -0,0 +1,19 @@ +# +# Dutch resource bundle for the /mode command in Jetrix +# +# @author Tim Van Wassenhove +# @author "Sobi" (so...@te...) +# @version $Revision$, $Date$ + +command.mode.description=Verander de configuratie van het kanaal. +command.mode.message0=PURE 15% sticks +command.mode.message1=COOKIES 1:1 (voor elke verwijderde regel krijg je 1 "special block") +command.mode.message2=PURE 20% sticks +command.mode.message3=COOKIE 2:1 (waneer je 2 regels verwijdert krijg je 1 "special block") +command.mode.message4=PURE 25% sticks +command.mode.message5=NO STICKS (0% stick) +command.mode.message6=ALL STICKS (100% stick) +command.mode.message7=COOKIES 1:1 alleen Z blocks +command.mode.message8=COOKIES 1:1 alleen L blocks +command.mode.message9=COOKIES 1:1 alleen T blocks +command.mode.enabled=<gray>Configuratie is veranderd naar <b>{0}</b> Property changes on: jetrix/trunk/src/lang/command/mode_nl.properties ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: jetrix/trunk/src/lang/command/mode_pt.properties =================================================================== --- jetrix/trunk/src/lang/command/mode_pt.properties (rev 0) +++ jetrix/trunk/src/lang/command/mode_pt.properties 2010-05-03 15:29:44 UTC (rev 846) @@ -0,0 +1,20 @@ +# +# Portuguese resource bundle for the /mode command in Jetrix +# +# @author V\xEDtor Melo +# @author "Scooter" (Tetridome player) +# @author "Luminoso" <lum...@gm...> +# @version $Revision$, $Date$ + +command.mode.description=Mude as configura\xE7\xF5es do canal. +command.mode.message0=PURE 15% sticks +command.mode.message1=COOKIES 1:1 (1 linha feita 1 special block) +command.mode.message2=PURE 20% sticks +command.mode.message3=COOKIE 2:1 (2 linhas feitas 1 special block) +command.mode.message4=PURE 25% sticks +command.mode.message5=SEM STICKS (0% stick) +command.mode.message6=S\xD3 STICKS (100% stick) +command.mode.message7=COOKIES 1:1 s\xF3 blocos Z +command.mode.message8=COOKIES 1:1 s\xF3 blocos L +command.mode.message9=COOKIES 1:1 s\xF3 blocos T +command.mode.enabled=<gray>Configura\xE7\xF5es mudadas para <b>{0}</b> Property changes on: jetrix/trunk/src/lang/command/mode_pt.properties ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Deleted: jetrix/trunk/src/lang/jetrix.properties =================================================================== --- jetrix/trunk/src/lang/jetrix.properties 2010-05-03 15:12:26 UTC (rev 845) +++ jetrix/trunk/src/lang/jetrix.properties 2010-05-03 15:29:44 UTC (rev 846) @@ -1,41 +0,0 @@ -# -# This is the default english resource bundle file that will be used by Jetrix -# if a resource bundle for a specific Locale cannot be found. -# -# Additional locales can be specified by creating a new resource file in this -# directory that follows the following convention : -# -# jetrix_<language code>.properties -# -# for example : -# jetrix_fr.properties (French resources) -# jetrix_de.properties (German resources) -# jetrix_ja.properties (Japanese resources) -# -# The two digit language code must be lower case. A full list of language codes -# can be found at http://www-old.ics.uci.edu/pub/ietf/http/related/iso639.txt -# -# In order to enable a specific locale you must edit the Jetrix configuration -# file (config.xml) and insert the language code into the "language" tag : -# -# <tetrinet-server> -# ... -# <language>fr</language> -# ... -# </tetrinet-server> -# -# Some property strings are parameterized using braces, for example : -# -# "{0} has joined channel {1}" -# -# This will be converted into something like : -# -# "Smanux has joined channel #jetrix" -# -# You can also use style codes like [red], [green], [b]...[/b] -# -# Feel free to send your translation to sm...@lf... to make it available -# to all Jetrix users ! -# -# @author Emmanuel Bourg -# @version $Revision$, $Date$ Modified: jetrix/trunk/src/lang/jetrix_en.properties =================================================================== --- jetrix/trunk/src/lang/jetrix_en.properties 2010-05-03 15:12:26 UTC (rev 845) +++ jetrix/trunk/src/lang/jetrix_en.properties 2010-05-03 15:29:44 UTC (rev 846) @@ -167,19 +167,6 @@ command.list.status.open=OPEN command.list.status.full=FULL -command.mode.description=Change the channel's configuration. -command.mode.message0=PURE 15% sticks -command.mode.message1=COOKIES 1:1 (1 line cleared yields one special block) -command.mode.message2=PURE 20% sticks -command.mode.message3=COOKIE 2:1 (2 lines cleared yield one special block) -command.mode.message4=PURE 25% sticks -command.mode.message5=NO STICKS (0% stick) -command.mode.message6=ALL STICKS (100% stick) -command.mode.message7=COOKIES 1:1 with Z blocks only -command.mode.message8=COOKIES 1:1 with L blocks only -command.mode.message9=COOKIES 1:1 with T blocks only -command.mode.enabled=<gray>Configuration changed to <b>{0}</b> - command.motd.description=Display the message of the day. command.move.description=Move a player to a new slot. Modified: jetrix/trunk/src/lang/jetrix_fr.properties =================================================================== --- jetrix/trunk/src/lang/jetrix_fr.properties 2010-05-03 15:12:26 UTC (rev 845) +++ jetrix/trunk/src/lang/jetrix_fr.properties 2010-05-03 15:29:44 UTC (rev 846) @@ -131,19 +131,6 @@ command.list.status.open=OUVERT command.list.status.full=COMPLET -command.mode.description=Change la configuration du channel. -command.mode.message0=PURE 15% de lignes -command.mode.message1=COOKIES 1:1 (1 ligne effac\xE9e donne 1 bloc special) -command.mode.message2=PURE 20% de lignes -command.mode.message3=COOKIE 2:1 (2 lignes effac\xE9es donnent 1 bloc sp\xE9cial) -command.mode.message4=PURE 25% de lignes -command.mode.message5=SANS LIGNES (0% lignes) -command.mode.message6=TOUT LIGNES (100% lignes) -command.mode.message7=COOKIES 1:1 avec seulement des blocs Z -command.mode.message8=COOKIES 1:1 avec seulement des blocs L -command.mode.message9=COOKIES 1:1 avec seulement des blocs T -command.mode.enabled=<gray>Configuration chang\xE9e en <b>{0}</b> - command.motd.description=Affiche le message du jour. command.move.description=D\xE9place un joueur \xE0 un autre emplacement. @@ -209,7 +196,7 @@ filter.flood.blocked=<red>Flot de messages bloqu\xE9 en provenance de <b>{0} -filter.puzzle.announce=<b><brown>Niveay <aqua>{0}</aqua> : <purple>"{1}"</purple> <i>Con\xE7u par</i> <aqua>{2}</aqua>. +filter.puzzle.announce=<b><brown>Niveau <aqua>{0}</aqua> : <purple>"{1}"</purple> <i>Con\xE7u par</i> <aqua>{2}</aqua>. filter.puzzle.cleared=<b><red>F\xE9licitations ! Puzzle r\xE9solu ! filter.tetris.start_message=Le premier joueur qui r\xE9alise {0} tetris gagne ! Modified: jetrix/trunk/src/lang/jetrix_nl.properties =================================================================== --- jetrix/trunk/src/lang/jetrix_nl.properties 2010-05-03 15:12:26 UTC (rev 845) +++ jetrix/trunk/src/lang/jetrix_nl.properties 2010-05-03 15:29:44 UTC (rev 846) @@ -125,19 +125,6 @@ command.list.status.open=OPEN command.list.status.full=VOL -command.mode.description=Verander de configuratie van het kanaal. -command.mode.message0=PURE 15% sticks -command.mode.message1=COOKIES 1:1 (voor elke verwijderde regel krijg je 1 "special block") -command.mode.message2=PURE 20% sticks -command.mode.message3=COOKIE 2:1 (waneer je 2 regels verwijdert krijg je 1 "special block") -command.mode.message4=PURE 25% sticks -command.mode.message5=NO STICKS (0% stick) -command.mode.message6=ALL STICKS (100% stick) -command.mode.message7=COOKIES 1:1 alleen Z blocks -command.mode.message8=COOKIES 1:1 alleen L blocks -command.mode.message9=COOKIES 1:1 alleen T blocks -command.mode.enabled=<gray>Configuratie is veranderd naar <b>{0}</b> - command.motd.description=Toont de boodschap van de dag. command.move.description=Verplaatst de speler naar een andere plaats. Modified: jetrix/trunk/src/lang/jetrix_pt.properties =================================================================== --- jetrix/trunk/src/lang/jetrix_pt.properties 2010-05-03 15:12:26 UTC (rev 845) +++ jetrix/trunk/src/lang/jetrix_pt.properties 2010-05-03 15:29:44 UTC (rev 846) @@ -133,19 +133,6 @@ command.list.status.open=ABERTO command.list.status.full=CHEIO -command.mode.description=Mude as configura\xE7\xF5es do canal. -command.mode.message0=PURE 15% sticks -command.mode.message1=COOKIES 1:1 (1 linha feita 1 special block) -command.mode.message2=PURE 20% sticks -command.mode.message3=COOKIE 2:1 (2 linhas feitas 1 special block) -command.mode.message4=PURE 25% sticks -command.mode.message5=SEM STICKS (0% stick) -command.mode.message6=S\xD3 STICKS (100% stick) -command.mode.message7=COOKIES 1:1 s\xF3 blocos Z -command.mode.message8=COOKIES 1:1 s\xF3 blocos L -command.mode.message9=COOKIES 1:1 s\xF3 blocos T -command.mode.enabled=<gray>Configura\xE7\xF5es mudadas para <b>{0}</b> - command.motd.description=Exibe a mensagem do dia. command.move.description=Move um jogador para um novo slot. Modified: jetrix/trunk/src/test/net/jetrix/LanguageTest.java =================================================================== --- jetrix/trunk/src/test/net/jetrix/LanguageTest.java 2010-05-03 15:12:26 UTC (rev 845) +++ jetrix/trunk/src/test/net/jetrix/LanguageTest.java 2010-05-03 15:29:44 UTC (rev 846) @@ -31,6 +31,13 @@ */ public class LanguageTest extends TestCase { + protected void setUp() throws Exception + { + Locale.setDefault(Locale.KOREA); + Language.getInstance().addResources("jetrix"); + Language.getInstance().addResources("foo"); + } + public void testLoad() { Language language = Language.getInstance(); @@ -40,6 +47,7 @@ public void testIsSupported() { assertTrue("french is not supported", Language.isSupported(Locale.FRENCH)); + assertFalse("korean is supported", Language.isSupported(Locale.KOREAN)); } public void testGetText() @@ -50,9 +58,9 @@ public void testGetTextWithParameter() { - Object[] params = new Object[] { "Smanux", "tetrinet1" }; - String englishText = "<gray>Hello Smanux, you are in channel <b>tetrinet1</b>"; - String frenchText = "<gray>Salut Smanux, tu es dans le channel <b>tetrinet1</b>"; + Object[] params = new Object[] { "Smanux", 123 }; + String englishText = "<gray>Hello Smanux, you are in channel <b>123</b>"; + String frenchText = "<gray>Salut Smanux, tu es dans le channel <b>123</b>"; assertEquals("welcome message in english", englishText, Language.getText("channel.welcome", Locale.ENGLISH, params)); assertEquals("welcome message in french", frenchText, Language.getText("channel.welcome", Locale.FRENCH, params)); } @@ -83,4 +91,10 @@ assertTrue("english locale not found", locales.contains(Locale.ENGLISH)); assertTrue("french locale not found", locales.contains(Locale.FRENCH)); } + + public void testAdditionalBundle() + { + Language.getInstance().addResources("command.mode"); + assertEquals("<gray>Configuration changed to <b>yes</b>", Language.getText("command.mode.enabled", Locale.ENGLISH, "key:common.yes")); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-05-03 15:12:32
|
Revision: 845 http://jetrix.svn.sourceforge.net/jetrix/?rev=845&view=rev Author: smanux Date: 2010-05-03 15:12:26 +0000 (Mon, 03 May 2010) Log Message: ----------- Improved the input validation and the error message of the /mode command Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/commands/ModeCommand.java Modified: jetrix/trunk/src/java/net/jetrix/commands/ModeCommand.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/commands/ModeCommand.java 2010-05-03 12:59:45 UTC (rev 844) +++ jetrix/trunk/src/java/net/jetrix/commands/ModeCommand.java 2010-05-03 15:12:26 UTC (rev 845) @@ -57,7 +57,7 @@ public String getUsage(Locale locale) { - return "/\" + getAlias() + \" <0-" + modes.length + ">"; + return "/" + getAlias() + " <0-" + (modes.length - 1) + ">"; } public void updateSetting(Settings settings, int[] mode) @@ -76,7 +76,7 @@ Client client = (Client) message.getSource(); Channel channel = client.getChannel(); - if (message.getParameterCount() < 1) + if (message.getParameterCount() == 0) { Locale locale = client.getUser().getLocale(); @@ -89,20 +89,26 @@ } else { + int param = -1; + try { - int param = Integer.parseInt(message.getParameter(0)); - + param = Integer.parseInt(message.getParameter(0)); + } + catch (NumberFormatException e) { } + + if (param >= 0 && param < modes.length) + { updateSetting(channel.getConfig().getSettings(), modes[param]); PlineMessage enabled = new PlineMessage(); enabled.setKey("command.mode.enabled", "key:command.mode.message" + param); channel.send(enabled); } - catch (NumberFormatException e) + else { PlineMessage error = new PlineMessage(); - error.setKey("command.mode.usage" + "<red>/mode</red> <darkBlue><0-9></darkBlue>."); + error.setText("<red>/" + getAlias() + "</red> <blue><0-" + (modes.length - 1) + "></blue>"); client.send(error); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-05-03 12:59:53
|
Revision: 844 http://jetrix.svn.sourceforge.net/jetrix/?rev=844&view=rev Author: smanux Date: 2010-05-03 12:59:45 +0000 (Mon, 03 May 2010) Log Message: ----------- Updated the german translation (thanks to Michael from tetrinet.de) Modified Paths: -------------- jetrix/trunk/src/lang/jetrix_de.properties Modified: jetrix/trunk/src/lang/jetrix_de.properties =================================================================== --- jetrix/trunk/src/lang/jetrix_de.properties 2010-04-26 13:31:50 UTC (rev 843) +++ jetrix/trunk/src/lang/jetrix_de.properties 2010-05-03 12:59:45 UTC (rev 844) @@ -42,6 +42,7 @@ # to all Jetrix users ! # # @author Mario Meuser +# @author Michael "LitterarumLatro" from tetrinet.de # @version $Revision$, $Date$ channel.welcome=<gray>Hallo {0}, du befindest dich in Channel <b>{1}</b> @@ -66,8 +67,15 @@ channel.team.new=<brown>*** <b>{0}</b> ist nun in Team <b>{1}</b> channel.team.none=<brown>*** <b>{0}</b> ist jetzt alleine +server.user-online=<darkBlue><red>{0}</red> {1} und <red>{2}</red> {3} ist derzeit online. +server.users-online=<darkBlue><red>{0}</red> {1} und <red>{2}</red> {3} sind derzeit online. + common.yes=ja common.no=nein +common.player=Spieler +common.players=Spieler +common.spectator=Beobachter +common.spectators=Beobachter command.not_implemented=[darkBlue]{0} ist noch nicht verfuegbar command.invalid=<red>Ungueltiges /Kommando @@ -229,6 +237,9 @@ filter.flood.blocked=<red>Spam von Spieler <b>{0} blockiert +filter.puzzle.announce=<b><brown>Level <aqua>{0}</aqua> : <purple>"{1}"</purple> <i>Erstellt von</i> <aqua>{2}</aqua>. +filter.puzzle.cleared=<b><red>Gratulation! Puzzle gel\xF6st! + filter.tetris.start_message=Der erste Spieler mit {0} tetris gewinnt! filter.tetris.lead={0} fuehrt mit {1} tetris filter.tetris.tied={0} teilen sich die Fuehrung mit {1} tetris This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-04-26 13:32:01
|
Revision: 843 http://jetrix.svn.sourceforge.net/jetrix/?rev=843&view=rev Author: smanux Date: 2010-04-26 13:31:50 +0000 (Mon, 26 Apr 2010) Log Message: ----------- Improvements to the Windows installer: - single shortcut instead of a directory in the program menu - internationalization - new UI Modified Paths: -------------- jetrix/trunk/src/bin/installer.nsi Modified: jetrix/trunk/src/bin/installer.nsi =================================================================== --- jetrix/trunk/src/bin/installer.nsi 2010-04-26 13:26:37 UTC (rev 842) +++ jetrix/trunk/src/bin/installer.nsi 2010-04-26 13:31:50 UTC (rev 843) @@ -5,6 +5,8 @@ !define PRODUCT_VERSION "@version@" !define PRODUCT_PUBLISHER "Emmanuel Bourg" !define PRODUCT_WEB_SITE "http://jetrix.sourceforge.net" +!define PRODUCT_CHANGELOG "http://jetrix.sourceforge.net/changelog.php" +!define PRODUCT_SUPPORT "https://sourceforge.net/projects/jetrix/forums/forum/172941" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\jetrix.exe" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_ROOT_KEY "HKLM" @@ -19,6 +21,12 @@ !define MUI_ABORTWARNING !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico" !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" +!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\orange.bmp" +!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp" +!define MUI_WELCOMEPAGE_TITLE_3LINES +!define MUI_FINISHPAGE_LINK "${PRODUCT_WEB_SITE}" +!define MUI_FINISHPAGE_LINK_LOCATION "${PRODUCT_WEB_SITE}" +!define MUI_FINISHPAGE_TEXT_LARGE ; Welcome page !insertmacro MUI_PAGE_WELCOME @@ -36,7 +44,11 @@ !insertmacro MUI_UNPAGE_INSTFILES ; Language files +!insertmacro MUI_LANGUAGE "Dutch" !insertmacro MUI_LANGUAGE "English" +!insertmacro MUI_LANGUAGE "French" +!insertmacro MUI_LANGUAGE "German" +!insertmacro MUI_LANGUAGE "Spanish" ; Reserve files !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS @@ -49,20 +61,18 @@ InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" ShowInstDetails show ShowUnInstDetails show +XPStyle on Section "MainSection" SEC01 SetOutPath "$INSTDIR" SetOverwrite ifnewer File "${BASE_PATH}\build\bin\jetrix.exe" File /r "${BASE_PATH}\deploy\jetrix-${PRODUCT_VERSION}\*" - CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}" - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" "$INSTDIR\jetrix.exe" + CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}.lnk" "$INSTDIR\jetrix.exe" SectionEnd Section -AdditionalIcons WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Jetrix Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall Jetrix.lnk" "$INSTDIR\uninst.exe" SectionEnd Section -Post @@ -73,28 +83,26 @@ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\jetrix.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLUpdateInfo" "${PRODUCT_CHANGELOG}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "HelpLink" "${PRODUCT_SUPPORT}" + WriteRegDWORD ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "NoRepair" 0x00000001 + WriteRegDWORD ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "NoModify" 0x00000001 SectionEnd -Function un.onUninstSuccess - HideWindow - MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer." -FunctionEnd - Function un.onInit MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2 Abort FunctionEnd Section Uninstall - Delete "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall Jetrix.lnk" - Delete "$SMPROGRAMS\${PRODUCT_NAME}\Jetrix Website.lnk" - Delete "$SMPROGRAMS\${PRODUCT_NAME}\Jetrix TetriNET Server.lnk" - + Delete "$SMPROGRAMS\Jetrix TetriNET Server.lnk" + RMDir "$SMPROGRAMS\${PRODUCT_NAME}" RMDir /r "$INSTDIR" - + DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" SetAutoClose true This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-04-26 13:26:44
|
Revision: 842 http://jetrix.svn.sourceforge.net/jetrix/?rev=842&view=rev Author: smanux Date: 2010-04-26 13:26:37 +0000 (Mon, 26 Apr 2010) Log Message: ----------- Removed the confirmation message on running jetrix.exe Modified Paths: -------------- jetrix/trunk/src/bin/launcher.nsi Modified: jetrix/trunk/src/bin/launcher.nsi =================================================================== --- jetrix/trunk/src/bin/launcher.nsi 2010-04-13 08:27:06 UTC (rev 841) +++ jetrix/trunk/src/bin/launcher.nsi 2010-04-26 13:26:37 UTC (rev 842) @@ -65,12 +65,11 @@ $\nWithout it you cannot run Jetrix. \ $\n$\nWould you like to visit the Java website to download it?' \ IDNO +2 - ExecShell open "http://java.sun.com/getjava" + ExecShell open "http://java.com" Quit JreFound: Pop $R1 - MessageBox MB_ICONEXCLAMATION|MB_YESNO 'exec: $R0' IDNO +2 Exch $R0 FunctionEnd This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-04-13 08:27:12
|
Revision: 841 http://jetrix.svn.sourceforge.net/jetrix/?rev=841&view=rev Author: smanux Date: 2010-04-13 08:27:06 +0000 (Tue, 13 Apr 2010) Log Message: ----------- Specified the source encoding for Maven 2.0.x Modified Paths: -------------- jetrix/trunk/pom.xml Modified: jetrix/trunk/pom.xml =================================================================== --- jetrix/trunk/pom.xml 2010-04-12 23:48:14 UTC (rev 840) +++ jetrix/trunk/pom.xml 2010-04-13 08:27:06 UTC (rev 841) @@ -192,6 +192,7 @@ <configuration> <source>1.5</source> <target>1.5</target> + <encoding>ISO-8859-1</encoding> </configuration> </plugin> <plugin> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-04-12 23:48:20
|
Revision: 840 http://jetrix.svn.sourceforge.net/jetrix/?rev=840&view=rev Author: smanux Date: 2010-04-12 23:48:14 +0000 (Mon, 12 Apr 2010) Log Message: ----------- Finished implementing the client identification. The query data now show the client used by the players (gtetrinet, blocktrix, etc) Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/Client.java jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java Modified: jetrix/trunk/src/java/net/jetrix/Client.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/Client.java 2010-04-12 22:38:27 UTC (rev 839) +++ jetrix/trunk/src/java/net/jetrix/Client.java 2010-04-12 23:48:14 UTC (rev 840) @@ -69,12 +69,12 @@ User getUser(); /** - * Return the type of the client. + * Return the type of the client (tetrinet or tetrifast). */ String getType(); /** - * Return the version number of this client. + * Return the version of this client (1.13, 1.14, GTetrinet 0.7.10, etc). */ String getVersion(); Modified: jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java 2010-04-12 22:38:27 UTC (rev 839) +++ jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java 2010-04-12 23:48:14 UTC (rev 840) @@ -138,6 +138,11 @@ { message.getDestination().send(message); } + else if (message instanceof ClientInfoMessage) + { + ClientInfoMessage info = (ClientInfoMessage) message; + setVersion(info.getName() + " " + info.getVersion()); + } else if (channel != null) { // send the message to the channel assigned to this client This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-04-12 22:38:33
|
Revision: 839 http://jetrix.svn.sourceforge.net/jetrix/?rev=839&view=rev Author: smanux Date: 2010-04-12 22:38:27 +0000 (Mon, 12 Apr 2010) Log Message: ----------- TetrinetAgent now supports the clientinfo request/response Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/agent/TSpecAgent.java jetrix/trunk/src/java/net/jetrix/agent/TetrinetAgent.java jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java jetrix/trunk/src/test/net/jetrix/agent/TetrinetAgentTest.java Modified: jetrix/trunk/src/java/net/jetrix/agent/TSpecAgent.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/agent/TSpecAgent.java 2010-04-12 13:10:56 UTC (rev 838) +++ jetrix/trunk/src/java/net/jetrix/agent/TSpecAgent.java 2010-04-12 22:38:27 UTC (rev 839) @@ -21,7 +21,6 @@ import java.io.IOException; -import net.jetrix.messages.channel.*; import net.jetrix.protocols.TspecProtocol; /** @@ -32,35 +31,15 @@ */ public class TSpecAgent extends TetrinetAgent { - private String password; - public TSpecAgent(String name, String password) { super(name); - this.password = password; + this.teamname = password; this.protocol = new TspecProtocol(); } public void connect(String hostname) throws IOException { - connect(hostname, 31458, password); + connect(hostname, 31458, teamname); } - - public void onMessage(PlayerNumMessage m) - { - super.onMessage(m); - - // send the tspec password as the team name - TeamMessage team = new TeamMessage(); - team.setSlot(m.getSlot()); - team.setName(password); - try - { - send(team); - } - catch (IOException e) - { - e.printStackTrace(); - } - } } Modified: jetrix/trunk/src/java/net/jetrix/agent/TetrinetAgent.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/agent/TetrinetAgent.java 2010-04-12 13:10:56 UTC (rev 838) +++ jetrix/trunk/src/java/net/jetrix/agent/TetrinetAgent.java 2010-04-12 22:38:27 UTC (rev 839) @@ -30,6 +30,7 @@ import net.jetrix.Message; import net.jetrix.Protocol; +import net.jetrix.config.ServerConfig; import net.jetrix.protocols.TetrinetProtocol; import net.jetrix.messages.*; import net.jetrix.messages.channel.*; @@ -43,9 +44,22 @@ */ public class TetrinetAgent implements Agent { - private String name; + /** The name of the agent. */ + protected String clientName = "Jetrix"; + + /** The version of the agent. */ + protected String clientVersion = ServerConfig.VERSION; + + /** The name of the player. */ + protected String name; + + /** The name of the team. */ + protected String teamname; + + /** The hostname of the TetriNET server. */ private String hostname; + /** The current slot assigned by the server. */ private int slot; private Socket socket; @@ -145,7 +159,7 @@ } } - protected void send(String message) throws IOException + protected synchronized void send(String message) throws IOException { out.write(message); out.write(protocol.getEOL()); @@ -229,6 +243,20 @@ public void onMessage(PlayerNumMessage m) { this.slot = m.getSlot(); + + // repond with the team name + TeamMessage response = new TeamMessage(); + response.setSlot(slot); + response.setName(teamname); + + try + { + send(response); + } + catch (IOException e) + { + e.printStackTrace(); + } } public void onMessage(StartGameMessage m) { } @@ -270,7 +298,24 @@ */ public void onSpecial(SpecialMessage m) { } - public void onMessage(LevelMessage m) { } + public void onMessage(LevelMessage m) + { + if (m.getLevel() == 0 && m.getSlot() == 0) + { + ClientInfoMessage response = new ClientInfoMessage(); + response.setName(clientName); + response.setVersion(clientVersion); + + try + { + send(response); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } public void onMessage(FieldMessage m) { } Modified: jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java 2010-04-12 13:10:56 UTC (rev 838) +++ jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java 2010-04-12 22:38:27 UTC (rev 839) @@ -372,6 +372,7 @@ else if (m instanceof WinlistMessage) { return translate((WinlistMessage) m, locale); } else if (m instanceof NoopMessage) { return translate((NoopMessage) m); } else if (m instanceof CommandMessage) { return translate((CommandMessage) m); } + else if (m instanceof ClientInfoMessage) { return translate((ClientInfoMessage) m); } else { return null; @@ -780,6 +781,16 @@ return message.toString(); } + public String translate(ClientInfoMessage m) + { + StringBuilder message = new StringBuilder(); + message.append("clientinfo "); + message.append(m.getName()); + message.append(" "); + message.append(m.getVersion()); + return message.toString(); + } + public String translate(NoopMessage m) { return ""; Modified: jetrix/trunk/src/test/net/jetrix/agent/TetrinetAgentTest.java =================================================================== --- jetrix/trunk/src/test/net/jetrix/agent/TetrinetAgentTest.java 2010-04-12 13:10:56 UTC (rev 838) +++ jetrix/trunk/src/test/net/jetrix/agent/TetrinetAgentTest.java 2010-04-12 22:38:27 UTC (rev 839) @@ -34,8 +34,9 @@ { TetrinetAgent agent = new TetrinetAgent("JetrixBot"); agent.connect("tetrinet.fr"); - - agent.send(new TeamMessage()); + + Thread.sleep(200); + agent.send(new PlineMessage("Hi there!")); agent.disconnect(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-04-12 13:11:04
|
Revision: 838 http://jetrix.svn.sourceforge.net/jetrix/?rev=838&view=rev Author: smanux Date: 2010-04-12 13:10:56 +0000 (Mon, 12 Apr 2010) Log Message: ----------- Fixed a minor issue with Maven Modified Paths: -------------- jetrix/trunk/pom.xml Modified: jetrix/trunk/pom.xml =================================================================== --- jetrix/trunk/pom.xml 2010-04-11 22:42:20 UTC (rev 837) +++ jetrix/trunk/pom.xml 2010-04-12 13:10:56 UTC (rev 838) @@ -163,7 +163,7 @@ <testResources> <testResource> <directory>src/etc</directory> - <targetPath>/</targetPath> + <targetPath>./</targetPath> <includes> <include>**/*.xml</include> <include>*.dtd</include> @@ -171,14 +171,14 @@ </testResource> <testResource> <directory>src/lang</directory> - <targetPath>/</targetPath> + <targetPath>./</targetPath> <includes> <include>*.properties</include> </includes> </testResource> <testResource> <directory>src/etc/data/puzzle</directory> - <targetPath>/data/puzzle</targetPath> + <targetPath>./data/puzzle</targetPath> <includes> <include>*.field</include> <include>*.settings</include> @@ -314,4 +314,8 @@ </plugins> </reporting> + <properties> + <project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding> + </properties> + </project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-04-11 22:42:27
|
Revision: 837 http://jetrix.svn.sourceforge.net/jetrix/?rev=837&view=rev Author: smanux Date: 2010-04-11 22:42:20 +0000 (Sun, 11 Apr 2010) Log Message: ----------- Introduced an output encoding per client Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/Client.java jetrix/trunk/src/java/net/jetrix/Protocol.java jetrix/trunk/src/java/net/jetrix/agent/QueryAgent.java jetrix/trunk/src/java/net/jetrix/agent/TetrinetAgent.java jetrix/trunk/src/java/net/jetrix/clients/ConsoleClient.java jetrix/trunk/src/java/net/jetrix/clients/QueryClient.java jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java jetrix/trunk/src/java/net/jetrix/listeners/TSpecListener.java jetrix/trunk/src/java/net/jetrix/listeners/TetrinetListener.java jetrix/trunk/src/java/net/jetrix/protocols/AbstractProtocol.java jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java jetrix/trunk/src/test/net/jetrix/agent/QueryAgentTest.java Modified: jetrix/trunk/src/java/net/jetrix/Client.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/Client.java 2010-04-11 21:25:35 UTC (rev 836) +++ jetrix/trunk/src/java/net/jetrix/Client.java 2010-04-11 22:42:20 UTC (rev 837) @@ -96,6 +96,13 @@ long getIdleTime(); /** + * Returns the character encoding to be used for the messages sent to the client. + * + * @since 0.3 + */ + String getEncoding(); + + /** * Send a message to the client. The raw message property must be set. * * @param message the message to send Modified: jetrix/trunk/src/java/net/jetrix/Protocol.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/Protocol.java 2010-04-11 21:25:35 UTC (rev 836) +++ jetrix/trunk/src/java/net/jetrix/Protocol.java 2010-04-11 22:42:20 UTC (rev 837) @@ -19,9 +19,9 @@ package net.jetrix; -import java.util.*; -import java.io.Reader; import java.io.IOException; +import java.io.InputStream; +import java.util.Locale; /** * A protocol to communicate with a client. A protocol is responsible for @@ -91,6 +91,6 @@ * @param in the stream to be read * @throws IOException thrown if the stream is closed */ - String readLine(Reader in) throws IOException; + String readLine(InputStream in) throws IOException; } Modified: jetrix/trunk/src/java/net/jetrix/agent/QueryAgent.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/agent/QueryAgent.java 2010-04-11 21:25:35 UTC (rev 836) +++ jetrix/trunk/src/java/net/jetrix/agent/QueryAgent.java 2010-04-11 22:42:20 UTC (rev 837) @@ -19,12 +19,11 @@ package net.jetrix.agent; -import java.io.BufferedReader; -import java.io.BufferedWriter; +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.io.Writer; +import java.io.InputStream; +import java.io.OutputStream; import java.net.InetSocketAddress; import java.net.Socket; import java.util.ArrayList; @@ -48,8 +47,8 @@ { private String hostname; private Socket socket; - private BufferedReader in; - private Writer out; + private InputStream in; + private OutputStream out; private Logger log = Logger.getLogger("net.jetrix"); @@ -58,8 +57,8 @@ this.hostname = hostname; socket = new Socket(); socket.connect(new InetSocketAddress(hostname, 31457), 5000); - in = new BufferedReader(new InputStreamReader(socket.getInputStream(), "ISO-8859-1")); - out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), "ISO-8859-1")); + in = new BufferedInputStream(socket.getInputStream()); + out = new BufferedOutputStream(socket.getOutputStream()); socket.setSoTimeout(10000); } @@ -73,7 +72,7 @@ public void send(String message) throws IOException { - out.write(message); + out.write(message.getBytes("ISO-8859-1")); out.write(0xFF); out.flush(); } @@ -113,9 +112,10 @@ send("version"); // read the result - String version = in.readLine(); - in.readLine(); - + QueryProtocol protocol = new QueryProtocol(); + String version = protocol.readLine(in); + protocol.readLine(in); + return version; } @@ -128,8 +128,9 @@ send("playerquery"); // read the result - String line = in.readLine(); - + QueryProtocol protocol = new QueryProtocol(); + String line = protocol.readLine(in); + if (line.startsWith("Number of players logged in: ")) { return Integer.parseInt(line.substring(line.indexOf(":") + 1).trim()); Modified: jetrix/trunk/src/java/net/jetrix/agent/TetrinetAgent.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/agent/TetrinetAgent.java 2010-04-11 21:25:35 UTC (rev 836) +++ jetrix/trunk/src/java/net/jetrix/agent/TetrinetAgent.java 2010-04-11 22:42:20 UTC (rev 837) @@ -19,10 +19,10 @@ package net.jetrix.agent; -import java.io.BufferedReader; +import java.io.BufferedInputStream; import java.io.BufferedWriter; import java.io.IOException; -import java.io.InputStreamReader; +import java.io.InputStream; import java.io.OutputStreamWriter; import java.io.Writer; import java.net.Socket; @@ -49,7 +49,7 @@ private int slot; private Socket socket; - private BufferedReader in; + private InputStream in; private Writer out; protected Protocol protocol = new TetrinetProtocol(); @@ -82,7 +82,7 @@ socket = new Socket(hostname, port); socket.setSoTimeout(15000); - in = new BufferedReader(new InputStreamReader(socket.getInputStream(), "ISO-8859-1")); + in = new BufferedInputStream(socket.getInputStream()); out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), "ISO-8859-1")); send(TetrinetProtocol.encode(name, version, socket.getInetAddress().getAddress(), false)); Modified: jetrix/trunk/src/java/net/jetrix/clients/ConsoleClient.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/clients/ConsoleClient.java 2010-04-11 21:25:35 UTC (rev 836) +++ jetrix/trunk/src/java/net/jetrix/clients/ConsoleClient.java 2010-04-11 22:42:20 UTC (rev 837) @@ -21,6 +21,7 @@ import java.io.*; import java.net.*; +import java.nio.charset.Charset; import java.util.*; import java.util.logging.Logger; @@ -167,6 +168,11 @@ return 0; } + public String getEncoding() + { + return Charset.defaultCharset().name(); + } + public void disconnect() { try Modified: jetrix/trunk/src/java/net/jetrix/clients/QueryClient.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/clients/QueryClient.java 2010-04-11 21:25:35 UTC (rev 836) +++ jetrix/trunk/src/java/net/jetrix/clients/QueryClient.java 2010-04-11 22:42:20 UTC (rev 837) @@ -174,7 +174,8 @@ try { - out.write(rawMessage + QueryProtocol.EOL, 0, rawMessage.length() + 1); + out.write(rawMessage.getBytes(getEncoding())); + out.write(QueryProtocol.EOL); out.flush(); if (log.isLoggable(Level.FINEST)) Modified: jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java 2010-04-11 21:25:35 UTC (rev 836) +++ jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java 2010-04-11 22:42:20 UTC (rev 837) @@ -51,8 +51,8 @@ protected boolean disconnected; private boolean running; - protected Reader in; - protected Writer out; + protected InputStream in; + protected OutputStream out; protected Socket socket; protected ServerConfig serverConfig; protected Logger log = Logger.getLogger("net.jetrix"); @@ -227,7 +227,8 @@ { synchronized (out) { - out.write(rawMessage + getProtocol().getEOL(), 0, rawMessage.length() + 1); + out.write(rawMessage.getBytes(getEncoding())); + out.write(getProtocol().getEOL()); out.flush(); } @@ -280,8 +281,8 @@ this.socket = socket; try { - in = new BufferedReader(new InputStreamReader(socket.getInputStream(), ServerConfig.ENCODING)); - out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), ServerConfig.ENCODING)); + in = new BufferedInputStream(socket.getInputStream()); + out = new BufferedOutputStream(socket.getOutputStream()); } catch (IOException e) { @@ -359,6 +360,11 @@ return System.currentTimeMillis() - lastMessageTime; } + public String getEncoding() + { + return "ISO-8859-1"; + } + public void disconnect() { disconnected = true; Modified: jetrix/trunk/src/java/net/jetrix/listeners/TSpecListener.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/listeners/TSpecListener.java 2010-04-11 21:25:35 UTC (rev 836) +++ jetrix/trunk/src/java/net/jetrix/listeners/TSpecListener.java 2010-04-11 22:42:20 UTC (rev 837) @@ -19,7 +19,6 @@ package net.jetrix.listeners; -import java.io.*; import java.net.*; import net.jetrix.*; import net.jetrix.protocols.TspecProtocol; @@ -48,7 +47,7 @@ public Client getClient(Socket socket) throws Exception { TetrinetProtocol protocol = ProtocolManager.getInstance().getProtocol(TetrinetProtocol.class); - String init = protocol.readLine(new InputStreamReader(socket.getInputStream())); + String init = protocol.readLine(socket.getInputStream()); TSpecClient client = new TSpecClient(); client.setProtocol(ProtocolManager.getInstance().getProtocol(TspecProtocol.class)); Modified: jetrix/trunk/src/java/net/jetrix/listeners/TetrinetListener.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/listeners/TetrinetListener.java 2010-04-11 21:25:35 UTC (rev 836) +++ jetrix/trunk/src/java/net/jetrix/listeners/TetrinetListener.java 2010-04-11 22:42:20 UTC (rev 837) @@ -19,7 +19,6 @@ package net.jetrix.listeners; -import java.io.*; import java.net.*; import java.util.*; @@ -53,7 +52,7 @@ { // read the first line sent by the client Protocol protocol1 = protocolManager.getProtocol(TetrinetProtocol.class); - String init = protocol1.readLine(new InputStreamReader(socket.getInputStream())); + String init = protocol1.readLine(socket.getInputStream()); // test if the client is using the query protocol Protocol protocol = protocolManager.getProtocol(QueryProtocol.class); Modified: jetrix/trunk/src/java/net/jetrix/protocols/AbstractProtocol.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/protocols/AbstractProtocol.java 2010-04-11 21:25:35 UTC (rev 836) +++ jetrix/trunk/src/java/net/jetrix/protocols/AbstractProtocol.java 2010-04-11 22:42:20 UTC (rev 837) @@ -19,11 +19,12 @@ package net.jetrix.protocols; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; + import net.jetrix.Protocol; -import java.io.IOException; -import java.io.Reader; - /** * Abstract protocol implementing the readLine(Reader) method. * @@ -34,25 +35,27 @@ */ public abstract class AbstractProtocol implements Protocol { - public String readLine(Reader in) throws IOException + public String readLine(InputStream in) throws IOException { - StringBuilder input = new StringBuilder(); - - int readChar; - while ((readChar = in.read()) != -1 && readChar != getEOL() && readChar != 0x0A && readChar != 0x0D) + ByteArrayOutputStream input = new ByteArrayOutputStream(256); + + // todo define a maximum line length + + int b; + while ((b = in.read()) != -1 && b != getEOL() && b != 0x0A && b != 0x0D) { - if (readChar != 0x0A && readChar != 0x0D) + if (b != 0x0A && b != 0x0D) { - input.append((char) readChar); + input.write(b); } } - - if (readChar == -1) + + if (b == -1) { throw new IOException("End of stream"); } - - return input.toString(); + + return input.toString("ISO-8859-1"); } public boolean equals(Object o) Modified: jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java 2010-04-11 21:25:35 UTC (rev 836) +++ jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java 2010-04-11 22:42:20 UTC (rev 837) @@ -239,22 +239,19 @@ // newgame else if ("newgame".equals(cmd)) { - NewGameMessage newgame = new NewGameMessage(); - m = newgame; + m = new NewGameMessage(); // todo parse the game settings } // endgame else if ("endgame".equals(cmd)) { - EndGameMessage end = new EndGameMessage(); - m = end; + m = new EndGameMessage(); } // ingame else if ("ingame".equals(cmd)) { - IngameMessage ingame = new IngameMessage(); - m = ingame; + m = new IngameMessage(); } // playerlost <slot> else if ("playerlost".equals(cmd)) @@ -556,7 +553,7 @@ message.append(s.getClassicRules() ? "1" : "0"); // extended parameter for 1.14 clients - if (s.getSameBlocks() == true) + if (s.getSameBlocks()) { message.append(" "); String hexstring = Integer.toHexString(m.getSeed()).toUpperCase(); Modified: jetrix/trunk/src/test/net/jetrix/agent/QueryAgentTest.java =================================================================== --- jetrix/trunk/src/test/net/jetrix/agent/QueryAgentTest.java 2010-04-11 21:25:35 UTC (rev 836) +++ jetrix/trunk/src/test/net/jetrix/agent/QueryAgentTest.java 2010-04-11 22:42:20 UTC (rev 837) @@ -29,10 +29,12 @@ */ public class QueryAgentTest extends TestCase { + private String hostname = "tetrinet.fr"; + public void testGetVersion() throws Exception { QueryAgent agent = new QueryAgent(); - agent.connect("tetrinet.fr"); + agent.connect(hostname); String version = agent.getVersion(); agent.disconnect(); @@ -42,7 +44,7 @@ public void testGetPlayerNumber() throws Exception { QueryAgent agent = new QueryAgent(); - agent.connect("tetrinet.fr"); + agent.connect(hostname); int count = agent.getPlayerNumber(); agent.disconnect(); @@ -52,7 +54,7 @@ public void testGetChannels() throws Exception { QueryAgent agent = new QueryAgent(); - agent.connect("tetrinet.fr"); + agent.connect(hostname); List<ChannelInfo> channels = agent.getChannels(); agent.disconnect(); @@ -63,7 +65,7 @@ public void testGetPlayers() throws Exception { QueryAgent agent = new QueryAgent(); - agent.connect("tetrinet.fr"); + agent.connect("tetridome.com"); List<PlayerInfo> players = agent.getPlayers(); agent.disconnect(); @@ -74,7 +76,7 @@ public void testGetPing() throws Exception { QueryAgent agent = new QueryAgent(); - agent.connect("tetrinet.fr"); + agent.connect(hostname); long ping = agent.getPing(); agent.disconnect(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-04-11 21:25:41
|
Revision: 836 http://jetrix.svn.sourceforge.net/jetrix/?rev=836&view=rev Author: smanux Date: 2010-04-11 21:25:35 +0000 (Sun, 11 Apr 2010) Log Message: ----------- Fixed the failing test cases Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/Channel.java jetrix/trunk/src/java/net/jetrix/ChannelManager.java jetrix/trunk/src/java/net/jetrix/filter/DownstackPuzzleGenerator.java jetrix/trunk/src/java/net/jetrix/protocols/AbstractProtocol.java jetrix/trunk/src/test/net/jetrix/ChannelManagerTest.java jetrix/trunk/src/test/net/jetrix/filter/DownstackPuzzleGeneratorTest.java jetrix/trunk/src/test/net/jetrix/protocols/TSpecProtocolTest.java jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java Modified: jetrix/trunk/src/java/net/jetrix/Channel.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/Channel.java 2010-04-11 21:22:54 UTC (rev 835) +++ jetrix/trunk/src/java/net/jetrix/Channel.java 2010-04-11 21:25:35 UTC (rev 836) @@ -43,14 +43,17 @@ */ public class Channel extends Thread implements Destination { + /** The maximum number of players per channel. */ + public static final int MAX_PLAYERS = 6; + private ChannelConfig channelConfig; private ServerConfig serverConfig; private Logger log = Logger.getLogger("net.jetrix"); - private BlockingQueue<Message> queue; + private BlockingQueue<Message> queue = new LinkedBlockingQueue<Message>(); private boolean open; - private GameState gameState; + private GameState gameState = STOPPED; private boolean running = true; private GameResult result; @@ -58,13 +61,13 @@ private long startTime; /** set of clients connected to this channel */ - private Set<Client> clients; + private Set<Client> clients = new HashSet<Client>(); /** slot/player mapping */ - private List<Client> slots; - private Field[] fields = new Field[6]; + private List<Client> slots = Arrays.asList(new Client[MAX_PLAYERS]); + private Field[] fields = new Field[MAX_PLAYERS]; - private List<MessageFilter> filters; + private List<MessageFilter> filters = new ArrayList<MessageFilter>(); public Channel() { @@ -75,36 +78,25 @@ { this.channelConfig = channelConfig; this.serverConfig = Server.getInstance().getConfig(); - this.gameState = STOPPED; - this.clients = new HashSet<Client>(); - this.slots = new ArrayList<Client>(6); - - // initialize the slot mapping - for (int i = 0; i < 6; i++) - { - slots.add(null); - } - + // initialize the players' fields - for (int i = 0; i < 6; i++) + for (int i = 0; i < MAX_PLAYERS; i++) { fields[i] = new Field(); } - - // opening channel message queue - queue = new LinkedBlockingQueue<Message>(); - - filters = new ArrayList<MessageFilter>(); - + /** * Loading filters */ // global filters - Iterator<FilterConfig> globalFilters = serverConfig.getGlobalFilters(); - while (globalFilters.hasNext()) + if (serverConfig != null) { - addFilter(globalFilters.next()); + Iterator<FilterConfig> globalFilters = serverConfig.getGlobalFilters(); + while (globalFilters.hasNext()) + { + addFilter(globalFilters.next()); + } } // channel filters @@ -470,7 +462,7 @@ } // clear the players' fields - for (int i = 0; i < 6; i++) + for (int i = 0; i < MAX_PLAYERS; i++) { fields[i].clear(); } @@ -546,7 +538,7 @@ if (previousChannel != null && !client.supportsMultipleChannels()) { // clear the player list - for (int j = 1; j <= 6; j++) + for (int j = 1; j <= MAX_PLAYERS; j++) { if (previousChannel.getPlayer(j) != null) { @@ -592,7 +584,7 @@ int slot = 0; for (slot = 0; slot < slots.size() && slots.get(slot) != null; slot++) ; - if (slot >= 6) + if (slot >= MAX_PLAYERS) { log.warning("[" + getConfig().getName() + "] Panic, no slot available for " + client); client.getUser().setSpectator(); @@ -646,7 +638,7 @@ } // send the fields - for (int i = 0; i < 6; i++) + for (int i = 0; i < MAX_PLAYERS; i++) { if (!fields[i].isEmpty() || previousChannel != null) { Modified: jetrix/trunk/src/java/net/jetrix/ChannelManager.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/ChannelManager.java 2010-04-11 21:22:54 UTC (rev 835) +++ jetrix/trunk/src/java/net/jetrix/ChannelManager.java 2010-04-11 21:25:35 UTC (rev 836) @@ -83,7 +83,9 @@ { // get the channel Channel channel = getChannel(name); - + + removeChannel(channel); + // close it as soon as the last client leaves channel.getConfig().setPersistent(false); channel.send(new ShutdownMessage()); Modified: jetrix/trunk/src/java/net/jetrix/filter/DownstackPuzzleGenerator.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/filter/DownstackPuzzleGenerator.java 2010-04-11 21:22:54 UTC (rev 835) +++ jetrix/trunk/src/java/net/jetrix/filter/DownstackPuzzleGenerator.java 2010-04-11 21:25:35 UTC (rev 836) @@ -64,35 +64,51 @@ public Puzzle getNextPuzzle() { - Puzzle puzzle = new Puzzle(); - try { // load the field File[] levels = getLevels(); File file = levels[level % levels.length]; level = level + 1; - Field field = new Field(); - field.load(file.getAbsolutePath()); - puzzle.setField(field); + + Puzzle puzzle = loadPuzzle(new File(path), file.getName().substring(0, file.getName().lastIndexOf("."))); puzzle.setKey(String.valueOf(level)); - - // load the settings - String name = file.getAbsolutePath().replace(".field", ".settings"); - readSettings(puzzle, name); + + return puzzle; } catch (IOException e) { log.log(Level.WARNING, e.getMessage(), e); } + + return null; + } + /** + * Load a puzzle from the filesystem. + * + * @param directory the directory containing the puzzle file + * @param name the name of the puzzle + */ + protected Puzzle loadPuzzle(File directory, String name) throws IOException + { + Puzzle puzzle = new Puzzle(); + + // load the field + Field field = new Field(); + field.load(new File(directory, name + ".field").getAbsolutePath()); + puzzle.setField(field); + + // load the settings + readSettings(puzzle, new File(directory, name + ".settings").getAbsolutePath()); + return puzzle; } /** * Find all levels in the puzzle directory. */ - private File[] getLevels() + protected File[] getLevels() { File directory = new File(path); File[] files = directory.listFiles(new FilenameFilter() @@ -209,8 +225,5 @@ } } } - } - - } Modified: jetrix/trunk/src/java/net/jetrix/protocols/AbstractProtocol.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/protocols/AbstractProtocol.java 2010-04-11 21:22:54 UTC (rev 835) +++ jetrix/trunk/src/java/net/jetrix/protocols/AbstractProtocol.java 2010-04-11 21:25:35 UTC (rev 836) @@ -55,6 +55,32 @@ return input.toString(); } + public boolean equals(Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + Protocol that = (Protocol) o; + + if (!getName().equals(that.getName())) + { + return false; + } + + return true; + } + + public int hashCode() + { + return getName().hashCode(); + } + public String toString() { return "[Protocol name=" + getName() + "]"; Modified: jetrix/trunk/src/test/net/jetrix/ChannelManagerTest.java =================================================================== --- jetrix/trunk/src/test/net/jetrix/ChannelManagerTest.java 2010-04-11 21:22:54 UTC (rev 835) +++ jetrix/trunk/src/test/net/jetrix/ChannelManagerTest.java 2010-04-11 21:25:35 UTC (rev 836) @@ -38,6 +38,7 @@ public void setUp() { manager = ChannelManager.getInstance(); + manager.clear(); config1 = new ChannelConfig(); config1.setName("test1"); Modified: jetrix/trunk/src/test/net/jetrix/filter/DownstackPuzzleGeneratorTest.java =================================================================== --- jetrix/trunk/src/test/net/jetrix/filter/DownstackPuzzleGeneratorTest.java 2010-04-11 21:22:54 UTC (rev 835) +++ jetrix/trunk/src/test/net/jetrix/filter/DownstackPuzzleGeneratorTest.java 2010-04-11 21:25:35 UTC (rev 836) @@ -19,6 +19,8 @@ package net.jetrix.filter; +import java.io.File; + import junit.framework.*; import net.jetrix.config.*; @@ -31,20 +33,32 @@ public void testGetNextPuzzle() { PuzzleGenerator generator = new DownstackPuzzleGenerator(); - Puzzle puzzle = generator.getNextPuzzle(); + + for (int i = 0; i < 100; i++) + { + Puzzle puzzle = generator.getNextPuzzle(); + assertNotNull("puzzle null", puzzle); + assertNotNull("null settings", puzzle.getSettings()); + } + } + public void testLoadPuzzle() throws Exception + { + DownstackPuzzleGenerator generator = new DownstackPuzzleGenerator(); + Puzzle puzzle = generator.loadPuzzle(new File("data/puzzle"), "game3"); + assertNotNull("puzzle null", puzzle); - assertEquals("author", "Kl\x80r", puzzle.getAuthor()); - assertEquals("name", "PUzzle BoBblE", puzzle.getName()); - assertEquals("comment", "none", puzzle.getComment()); + assertEquals("author", "NiLS", puzzle.getAuthor()); + assertEquals("name", "Left or Right", puzzle.getName()); + assertEquals("comment", "no comment", puzzle.getComment()); assertNotNull("null field", puzzle.getField()); assertFalse("empty field", puzzle.getField().isEmpty()); Settings settings = puzzle.getSettings(); assertNotNull("null settings", settings); - - int[] blocks = { 14, 14, 14, 14, 15, 15, 14 }; + + int[] blocks = { 14, 14, 15, 14, 14, 14, 15 }; for (int i = 0; i < DownstackPuzzleGenerator.BLOCKS.length; i++) { Block block = DownstackPuzzleGenerator.BLOCKS[i]; @@ -56,8 +70,8 @@ { assertEquals(special.getCode() + " occurancy", specials[special.ordinal()], settings.getOccurancy(special)); } - - assertEquals("sudden death message", "Time! It's SUDDEN DEATH MODE!", settings.getSuddenDeathMessage()); + + assertEquals("sudden death message", "Time's up! It's SUDDEN DEATH MODE!", settings.getSuddenDeathMessage()); assertEquals("sudden death delay", 30, settings.getSuddenDeathDelay()); assertEquals("sudden death time", 180, settings.getSuddenDeathTime()); assertEquals("sudden death lines", 1, settings.getSuddenDeathLinesAdded()); @@ -72,5 +86,4 @@ assertEquals("classic rules", true, settings.getClassicRules()); assertEquals("average levels", true, settings.getAverageLevels()); } - } Modified: jetrix/trunk/src/test/net/jetrix/protocols/TSpecProtocolTest.java =================================================================== --- jetrix/trunk/src/test/net/jetrix/protocols/TSpecProtocolTest.java 2010-04-11 21:22:54 UTC (rev 835) +++ jetrix/trunk/src/test/net/jetrix/protocols/TSpecProtocolTest.java 2010-04-11 21:25:35 UTC (rev 836) @@ -79,7 +79,7 @@ assertEquals("message class", SmsgMessage.class, message.getClass()); SmsgMessage smsg = (SmsgMessage) message; - assertEquals("slot", 0, smsg.getSlot()); + assertEquals("slot", 1, smsg.getSlot()); assertEquals("private", false, smsg.isPrivate()); assertEquals("text", "spectator message", smsg.getText()); } @@ -93,7 +93,7 @@ assertEquals("message class", SmsgMessage.class, message.getClass()); SmsgMessage smsg = (SmsgMessage) message; - assertEquals("slot", 0, smsg.getSlot()); + assertEquals("slot", 1, smsg.getSlot()); assertEquals("private", true, smsg.isPrivate()); assertEquals("text", "spectator message", smsg.getText()); } Modified: jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java =================================================================== --- jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java 2010-04-11 21:22:54 UTC (rev 835) +++ jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java 2010-04-11 21:25:35 UTC (rev 836) @@ -111,15 +111,15 @@ public void testGetMessageGmsg() { - String raw = "gmsg hello world!"; + String raw = "gmsg <Smanux> Hello world!"; Message message = protocol.getMessage(raw); assertNotNull("message not parsed", message); assertEquals("message class", GmsgMessage.class, message.getClass()); GmsgMessage gmsg = (GmsgMessage) message; - assertEquals("slot", 1, gmsg.getSlot()); - assertEquals("text", "hello world!", gmsg.getText(Locale.ENGLISH)); + assertEquals("slot", 0, gmsg.getSlot()); + assertEquals("text", "<Smanux> Hello world!", gmsg.getText(Locale.ENGLISH)); } public void testTranslatePlayerJoin() @@ -268,7 +268,7 @@ { byte[] ip = {127, 0, 0, 1}; String nickname = "Smanux"; - String version = "1.14"; + String version = "1.13"; assertEquals("80C210B3134A85CF71E46FD4C123A83D9E22A2F512769FE5", encode(nickname, version, ip, false)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-04-11 21:23:00
|
Revision: 835 http://jetrix.svn.sourceforge.net/jetrix/?rev=835&view=rev Author: smanux Date: 2010-04-11 21:22:54 +0000 (Sun, 11 Apr 2010) Log Message: ----------- The shutdown hooks are now registered when the server is initialized Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/Server.java Modified: jetrix/trunk/src/java/net/jetrix/Server.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/Server.java 2010-04-11 20:45:49 UTC (rev 834) +++ jetrix/trunk/src/java/net/jetrix/Server.java 2010-04-11 21:22:54 UTC (rev 835) @@ -1,6 +1,6 @@ /** * Jetrix TetriNET Server - * Copyright (C) 2001-2009 Emmanuel Bourg + * Copyright (C) 2001-2010 Emmanuel Bourg * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -24,8 +24,6 @@ import java.util.concurrent.*; import java.util.logging.*; -import javax.mail.MessagingException; - import net.jetrix.clients.*; import net.jetrix.commands.*; import net.jetrix.config.*; @@ -34,7 +32,6 @@ import net.jetrix.services.VersionService; import net.jetrix.listeners.ShutdownListener; import net.jetrix.mail.MailSessionManager; -import net.jetrix.mail.MailMessage; /** * Main class, starts the server components and handle the server level messages. @@ -54,9 +51,13 @@ private ChannelManager channelManager; private Client console; - private Server() + private Server() { } + + /** + * Register the shutdown hooks to stop the server properly when the JVM is stopped. + */ + private void registerHooks() { - // add the stop hook Thread hook = new Thread("StopHook") { public void run() @@ -99,6 +100,8 @@ */ private void init() { + registerHooks(); + // read the server configuration config = new ServerConfig(); config.load(configFile); @@ -327,7 +330,7 @@ */ public static void main(String[] args) { - System.out.println("Jetrix TetriNET Server " + ServerConfig.VERSION + ", Copyright (C) 2001-2009 Emmanuel Bourg\n"); + System.out.println("Jetrix TetriNET Server " + ServerConfig.VERSION + ", Copyright (C) 2001-2010 Emmanuel Bourg\n"); Server server = Server.getInstance(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-04-11 20:45:56
|
Revision: 834 http://jetrix.svn.sourceforge.net/jetrix/?rev=834&view=rev Author: smanux Date: 2010-04-11 20:45:49 +0000 (Sun, 11 Apr 2010) Log Message: ----------- Encode the strings in Cp1252 for the tetrinetx winlists to improve the compatibility Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/winlist/TetrixWinlist.java jetrix/trunk/src/test/net/jetrix/winlist/TetrixWinlistTest.java Modified: jetrix/trunk/src/java/net/jetrix/winlist/TetrixWinlist.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/winlist/TetrixWinlist.java 2010-03-08 09:04:45 UTC (rev 833) +++ jetrix/trunk/src/java/net/jetrix/winlist/TetrixWinlist.java 2010-04-11 20:45:49 UTC (rev 834) @@ -25,7 +25,7 @@ import net.jetrix.config.*; /** - * A winlist caompatible with the tetrinetx winlist format. + * A winlist compatible with the tetrinetx winlist format. * * @author Emmanuel Bourg * @version $Revision$, $Date$ @@ -37,6 +37,7 @@ private long scoreCount = DEFAULT_WINLIST_SIZE; private String filename; + private String encoding = "Cp1252"; public void init(WinlistConfig config) { @@ -120,14 +121,14 @@ /** * Build a score from a tetrix winlist structure. */ - protected Score buildScore(byte[] struct) + protected Score buildScore(byte[] struct) throws IOException { Score score = null; if (struct[0] != 0) { score = new Score(); - score.setName(new String(struct, 1, 31).trim()); + score.setName(new String(struct, 1, 31, encoding).trim()); score.setType(struct[0] == 0x70 ? Score.TYPE_PLAYER : Score.TYPE_TEAM); long scoreValue = getUnsignedByte(struct, 32) + (getUnsignedByte(struct, 33) << 8) @@ -152,7 +153,7 @@ struct[0] = score.getType() == Score.TYPE_PLAYER ? (byte) 'p' : (byte) 't'; // name - byte[] name = score.getName().getBytes(ServerConfig.ENCODING); + byte[] name = score.getName().getBytes(encoding); System.arraycopy(name, 0, struct, 1, name.length); // score Modified: jetrix/trunk/src/test/net/jetrix/winlist/TetrixWinlistTest.java =================================================================== --- jetrix/trunk/src/test/net/jetrix/winlist/TetrixWinlistTest.java 2010-03-08 09:04:45 UTC (rev 833) +++ jetrix/trunk/src/test/net/jetrix/winlist/TetrixWinlistTest.java 2010-04-11 20:45:49 UTC (rev 834) @@ -37,7 +37,7 @@ public void setUp() { super.setUp(); - score = new Score("hell's_players\x86", Score.TYPE_TEAM, 1418); + score = new Score("hell's_players\u2020", Score.TYPE_TEAM, 1418); } public void testBuildScore() throws Exception @@ -51,7 +51,7 @@ assertEquals("type", score.getType(), score2.getType()); } - public void testBuildStruct() + public void testBuildStruct() throws Exception { TetrixWinlist winlist = new TetrixWinlist(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-03-08 09:04:52
|
Revision: 833 http://jetrix.svn.sourceforge.net/jetrix/?rev=833&view=rev Author: smanux Date: 2010-03-08 09:04:45 +0000 (Mon, 08 Mar 2010) Log Message: ----------- Simplified the Block and Special enums Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/commands/ModeCommand.java jetrix/trunk/src/java/net/jetrix/config/Block.java jetrix/trunk/src/java/net/jetrix/config/Settings.java jetrix/trunk/src/java/net/jetrix/config/Special.java jetrix/trunk/src/java/net/jetrix/filter/DownstackPuzzleGenerator.java jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java jetrix/trunk/src/test/net/jetrix/filter/DownstackPuzzleGeneratorTest.java Modified: jetrix/trunk/src/java/net/jetrix/commands/ModeCommand.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/commands/ModeCommand.java 2010-03-07 00:23:41 UTC (rev 832) +++ jetrix/trunk/src/java/net/jetrix/commands/ModeCommand.java 2010-03-08 09:04:45 UTC (rev 833) @@ -64,7 +64,7 @@ { for (Block block : Block.values()) { - settings.setOccurancy(block, mode[block.getValue()]); + settings.setOccurancy(block, mode[block.ordinal()]); } settings.setLinesPerSpecial(mode[7]); Modified: jetrix/trunk/src/java/net/jetrix/config/Block.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/config/Block.java 2010-03-07 00:23:41 UTC (rev 832) +++ jetrix/trunk/src/java/net/jetrix/config/Block.java 2010-03-08 09:04:45 UTC (rev 833) @@ -33,35 +33,21 @@ */ public enum Block { - LINE(0, "line"), - SQUARE(1, "square"), - LEFTL(2, "leftl"), - RIGHTL(3, "rightl"), - LEFTZ(4, "leftz"), - RIGHTZ(5, "rightz"), - HALFCROSS(6, "halfcross"); + LINE, + SQUARE, + LEFTL, + RIGHTL, + LEFTZ, + RIGHTZ, + HALFCROSS; - private int value; - private String code; - - Block(int value, String code) - { - this.value = value; - this.code = code; - } - - public int getValue() - { - return value; - } - public String getCode() { - return code; + return name().toLowerCase(); } public String getName(Locale locale) { - return Language.getText("command.config.blocks." + code, locale); + return Language.getText("command.config.blocks." + getCode(), locale); } } Modified: jetrix/trunk/src/java/net/jetrix/config/Settings.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/config/Settings.java 2010-03-07 00:23:41 UTC (rev 832) +++ jetrix/trunk/src/java/net/jetrix/config/Settings.java 2010-03-08 09:04:45 UTC (rev 833) @@ -211,12 +211,12 @@ public int getOccurancy(Block piece) { - return isDefaultBlockOccurancy() ? defaultSettings.getOccurancy(piece) : blockOccurancy[piece.getValue()]; + return isDefaultBlockOccurancy() ? defaultSettings.getOccurancy(piece) : blockOccurancy[piece.ordinal()]; } public int getOccurancy(Special special) { - return isDefaultSpecialOccurancy() ? defaultSettings.getOccurancy(special) : specialOccurancy[special.getValue()]; + return isDefaultSpecialOccurancy() ? defaultSettings.getOccurancy(special) : specialOccurancy[special.ordinal()]; } public void setStartingLevel(int startingLevel) @@ -341,7 +341,7 @@ Arrays.fill(blockOccurancy, 0); } - blockOccurancy[block.getValue()] = occurancy; + blockOccurancy[block.ordinal()] = occurancy; } /** @@ -360,7 +360,7 @@ Arrays.fill(specialOccurancy, 0); } - specialOccurancy[special.getValue()] = occurancy; + specialOccurancy[special.ordinal()] = occurancy; } /** Modified: jetrix/trunk/src/java/net/jetrix/config/Special.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/config/Special.java 2010-03-07 00:23:41 UTC (rev 832) +++ jetrix/trunk/src/java/net/jetrix/config/Special.java 2010-03-08 09:04:45 UTC (rev 833) @@ -33,32 +33,23 @@ */ public enum Special { - ADDLINE(0, 'a', "addline"), - CLEARLINE(1, 'c', "clearline"), - NUKEFIELD(2, 'n', "nukefield"), - RANDOMCLEAR(3, 'r', "randomclear"), - SWITCHFIELD(4, 's', "switchfield"), - CLEARSPECIAL(5, 'b', "clearspecial"), - GRAVITY(6, 'g', "gravity"), - QUAKEFIELD(7, 'q', "quakefield"), - BLOCKBOMB(8, 'o', "blockbomb"); + ADDLINE('a'), + CLEARLINE('c'), + NUKEFIELD('n'), + RANDOMCLEAR('r'), + SWITCHFIELD('s'), + CLEARSPECIAL('b'), + GRAVITY('g'), + QUAKEFIELD('q'), + BLOCKBOMB('o'); - private int value; private final char letter; - private String code; - Special(int value, char letter, String code) + Special(char letter) { - this.value = value; this.letter = letter; - this.code = code; } - public int getValue() - { - return value; - } - public char getLetter() { return letter; @@ -66,12 +57,12 @@ public String getCode() { - return code; + return name().toLowerCase(); } public String getName(Locale locale) { - return Language.getText("command.config.specials." + code, locale); + return Language.getText("command.config.specials." + getCode(), locale); } /** @@ -89,7 +80,7 @@ return special; } } - + return null; } } Modified: jetrix/trunk/src/java/net/jetrix/filter/DownstackPuzzleGenerator.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/filter/DownstackPuzzleGenerator.java 2010-03-07 00:23:41 UTC (rev 832) +++ jetrix/trunk/src/java/net/jetrix/filter/DownstackPuzzleGenerator.java 2010-03-08 09:04:45 UTC (rev 833) @@ -159,7 +159,7 @@ for (Special special : Special.values()) { - settings.setOccurancy(special, Integer.parseInt(occurancy[special.getValue()])); + settings.setOccurancy(special, Integer.parseInt(occurancy[special.ordinal()])); } } else if (line.startsWith("BLOCK")) Modified: jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java 2010-03-07 00:23:41 UTC (rev 832) +++ jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java 2010-03-08 09:04:45 UTC (rev 833) @@ -535,7 +535,7 @@ { for (int j = 0; j < s.getOccurancy(block); j++) { - message.append(Integer.toString(block.getValue() + 1)); + message.append(Integer.toString(block.ordinal() + 1)); } } @@ -546,7 +546,7 @@ { for (int j = 0; j < s.getOccurancy(special); j++) { - message.append(Integer.toString(special.getValue() + 1)); + message.append(Integer.toString(special.ordinal() + 1)); } } Modified: jetrix/trunk/src/test/net/jetrix/filter/DownstackPuzzleGeneratorTest.java =================================================================== --- jetrix/trunk/src/test/net/jetrix/filter/DownstackPuzzleGeneratorTest.java 2010-03-07 00:23:41 UTC (rev 832) +++ jetrix/trunk/src/test/net/jetrix/filter/DownstackPuzzleGeneratorTest.java 2010-03-08 09:04:45 UTC (rev 833) @@ -54,7 +54,7 @@ int[] specials = { 32, 18, 1, 11, 3, 14, 1, 6, 14 }; for (Special special : Special.values()) { - assertEquals(special.getCode() + " occurancy", specials[special.getValue()], settings.getOccurancy(special)); + assertEquals(special.getCode() + " occurancy", specials[special.ordinal()], settings.getOccurancy(special)); } assertEquals("sudden death message", "Time! It's SUDDEN DEATH MODE!", settings.getSuddenDeathMessage()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-03-07 00:23:47
|
Revision: 832 http://jetrix.svn.sourceforge.net/jetrix/?rev=832&view=rev Author: smanux Date: 2010-03-07 00:23:41 +0000 (Sun, 07 Mar 2010) Log Message: ----------- Persistence of the channel's sudden death settings Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java jetrix/trunk/src/java/net/jetrix/config/Settings.java Modified: jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java 2010-03-06 21:42:15 UTC (rev 831) +++ jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java 2010-03-07 00:23:41 UTC (rev 832) @@ -605,12 +605,33 @@ } out.println(" </special-occurancy>"); } - - // todo sudden death settings + // sudden death settings + if (!settings.isDefaultSuddenDeath()) + { + out.println(" <sudden-death>"); + if (!settings.isDefaultSuddenDeathTime()) + { + out.println(" <time>" + settings.getSuddenDeathTime() + "</time>"); + } + if (!settings.isDefaultSuddenDeathMessage()) + { + out.println(" <message>" + settings.getSuddenDeathMessage() + "</message>"); + } + if (!settings.isDefaultSuddenDeathDelay()) + { + out.println(" <delay>" + settings.getSuddenDeathDelay() + "</delay>"); + } + if (!settings.isDefaultSuddenDeathLinesAdded()) + { + out.println(" <lines-added>" + settings.getSuddenDeathLinesAdded() + "</lines-added>"); + } + out.println(" </sudden-death>"); + } + out.println(" </settings>"); } - + // local filters Collection<MessageFilter> filters = channel.getLocalFilters(); if (!filters.isEmpty()) Modified: jetrix/trunk/src/java/net/jetrix/config/Settings.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/config/Settings.java 2010-03-06 21:42:15 UTC (rev 831) +++ jetrix/trunk/src/java/net/jetrix/config/Settings.java 2010-03-07 00:23:41 UTC (rev 832) @@ -19,9 +19,6 @@ package net.jetrix.config; -import static net.jetrix.config.Block.*; -import static net.jetrix.config.Special.*; - import java.util.*; /** @@ -432,12 +429,17 @@ normalize(specialOccurancy); } + private boolean isDefault() + { + return defaultSettings == null || this == defaultSettings; + } + /** * Tells if the block occurancies of the default settings are used. */ public boolean isDefaultBlockOccurancy() { - return defaultBlockOccurancy && defaultSettings != null && this != defaultSettings; + return defaultBlockOccurancy && !isDefault(); } public void setDefaultBlockOccurancy(boolean defaultBlockOccurancy) @@ -450,7 +452,7 @@ */ public boolean isDefaultSpecialOccurancy() { - return defaultSpecialOccurancy && defaultSettings != null && this != defaultSettings; + return defaultSpecialOccurancy && !isDefault(); } public void setDefaultSpecialOccurancy(boolean defaultSpecialOccurancy) @@ -460,7 +462,7 @@ public boolean isDefaultStartingLevel() { - return defaultStartingLevel && defaultSettings != null && this != defaultSettings; + return defaultStartingLevel && !isDefault(); } public void setDefaultStartingLevel(boolean defaultStartingLevel) @@ -470,7 +472,7 @@ public boolean isDefaultStackHeight() { - return defaultStackHeight && defaultSettings != null && this != defaultSettings; + return defaultStackHeight && !isDefault(); } public void setDefaultStackHeight(boolean defaultStackHeight) @@ -480,7 +482,7 @@ public boolean isDefaultLinesPerLevel() { - return defaultLinesPerLevel && defaultSettings != null && this != defaultSettings; + return defaultLinesPerLevel && !isDefault(); } public void setDefaultLinesPerLevel(boolean defaultLinesPerLevel) @@ -490,7 +492,7 @@ public boolean isDefaultLinesPerSpecial() { - return defaultLinesPerSpecial && defaultSettings != null && this != defaultSettings; + return defaultLinesPerSpecial && !isDefault(); } public void setDefaultLinesPerSpecial(boolean defaultLinesPerSpecial) @@ -500,7 +502,7 @@ public boolean isDefaultLevelIncrease() { - return defaultLevelIncrease && defaultSettings != null && this != defaultSettings; + return defaultLevelIncrease && !isDefault(); } public void setDefaultLevelIncrease(boolean defaultLevelIncrease) @@ -510,7 +512,7 @@ public boolean isDefaultSpecialAdded() { - return defaultSpecialAdded && defaultSettings != null && this != defaultSettings; + return defaultSpecialAdded && !isDefault(); } public void setDefaultSpecialAdded(boolean defaultSpecialAdded) @@ -520,7 +522,7 @@ public boolean isDefaultSpecialCapacity() { - return defaultSpecialCapacity && defaultSettings != null && this != defaultSettings; + return defaultSpecialCapacity && !isDefault(); } public void setDefaultSpecialCapacity(boolean defaultSpecialCapacity) @@ -530,7 +532,7 @@ public boolean isDefaultAverageLevels() { - return defaultAverageLevels && defaultSettings != null && this != defaultSettings; + return defaultAverageLevels && !isDefault(); } public void setDefaultAverageLevels(boolean defaultAverageLevels) @@ -540,7 +542,7 @@ public boolean isDefaultClassicRules() { - return defaultClassicRules && defaultSettings != null && this != defaultSettings; + return defaultClassicRules && !isDefault(); } public void setDefaultClassicRules(boolean defaultClassicRules) @@ -550,7 +552,7 @@ public boolean isDefaultSameBlocks() { - return defaultSameBlocks && defaultSettings != null && this != defaultSettings; + return defaultSameBlocks && !isDefault(); } public void setDefaultSameBlocks(boolean defaultSameBlocks) @@ -560,7 +562,7 @@ public boolean isDefaultSuddenDeathTime() { - return defaultSuddenDeathTime && defaultSettings != null && this != defaultSettings; + return defaultSuddenDeathTime && !isDefault(); } public void setDefaultSuddenDeathTime(boolean defaultSuddenDeathTime) @@ -570,7 +572,7 @@ public boolean isDefaultSuddenDeathMessage() { - return defaultSuddenDeathMessage && defaultSettings != null && this != defaultSettings; + return defaultSuddenDeathMessage && !isDefault(); } public void setDefaultSuddenDeathMessage(boolean defaultSuddenDeathMessage) @@ -580,7 +582,7 @@ public boolean isDefaultSuddenDeathLinesAdded() { - return defaultSuddenDeathLinesAdded && defaultSettings != null && this != defaultSettings; + return defaultSuddenDeathLinesAdded && !isDefault(); } public void setDefaultSuddenDeathLinesAdded(boolean defaultSuddenDeathLinesAdded) @@ -590,7 +592,7 @@ public boolean isDefaultSuddenDeathDelay() { - return defaultSuddenDeathDelay && defaultSettings != null && this != defaultSettings; + return defaultSuddenDeathDelay && !isDefault(); } public void setDefaultSuddenDeathDelay(boolean defaultSuddenDeathDelay) @@ -598,4 +600,11 @@ this.defaultSuddenDeathDelay = defaultSuddenDeathDelay; } + public boolean isDefaultSuddenDeath() + { + return isDefaultSuddenDeathDelay() + && isDefaultSuddenDeathLinesAdded() + && isDefaultSuddenDeathMessage() + && isDefaultSuddenDeathTime(); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-03-06 21:42:24
|
Revision: 831 http://jetrix.svn.sourceforge.net/jetrix/?rev=831&view=rev Author: smanux Date: 2010-03-06 21:42:15 +0000 (Sat, 06 Mar 2010) Log Message: ----------- Removed the empty filter sections in the channel configurations Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/Channel.java jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java Modified: jetrix/trunk/src/java/net/jetrix/Channel.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/Channel.java 2010-02-28 23:54:45 UTC (rev 830) +++ jetrix/trunk/src/java/net/jetrix/Channel.java 2010-03-06 21:42:15 UTC (rev 831) @@ -165,6 +165,22 @@ } /** + * Returns the filters applied to this channel not defined at the server level. + */ + public Collection<MessageFilter> getLocalFilters() + { + Collection<MessageFilter> localFilters = new ArrayList<MessageFilter>(); + for (MessageFilter filter : filters) + { + if (!filter.getConfig().isGlobal()) + { + localFilters.add(filter); + } + } + return localFilters; + } + + /** * Main loop. The channel listens for incomming messages until the server * or the channel closes. Every message is first passed through the * registered filters and then handled by the channel. Modified: jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java 2010-02-28 23:54:45 UTC (rev 830) +++ jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java 2010-03-06 21:42:15 UTC (rev 831) @@ -380,26 +380,11 @@ out.println(); // global filters - Iterator<FilterConfig> filters = getGlobalFilters(); out.println(" <!-- Global filters -->"); out.println(" <default-filters>"); - while (filters.hasNext()) + for (FilterConfig filter : globalFilters) { - FilterConfig filter = filters.next(); - Properties props = filter.getProperties(); - if (props == null || props.isEmpty()) - { - out.println(" <filter name=\"" + filter.getName() + "\"/>"); - } - else - { - out.println(" <filter name=\"" + filter.getName() + "\">"); - for (Object name : props.keySet()) - { - out.println(" <param name=\"" + name + "\" value=\"" + props.get(name) + "\"/>"); - } - out.println(" </filter>"); - } + saveFilter(filter, out, " "); } out.println(" </default-filters>"); out.println(); @@ -621,70 +606,72 @@ out.println(" </special-occurancy>"); } - // sudden death settings - - - + // todo sudden death settings + out.println(" </settings>"); } - - // filters - Iterator<MessageFilter> it = channel.getFilters(); - if (it.hasNext()) + + // local filters + Collection<MessageFilter> filters = channel.getLocalFilters(); + if (!filters.isEmpty()) { - out.println(" <filters>"); // do not display if the channel has only global filters - while (it.hasNext()) + out.println(" <filters>"); + for (MessageFilter filter : filters) { - MessageFilter filter = it.next(); - if (!filter.getConfig().isGlobal()) - { - Properties props = filter.getConfig().getProperties(); - if (props == null || props.isEmpty()) - { - if (filter.getConfig().getName() != null) - { - out.println(" <filter name=\"" + filter.getConfig().getName() + "\"/>"); - } - else - { - out.println(" <filter class=\"" + filter.getConfig().getClassname() + "\"/>"); - } - } - else - { - if (filter.getConfig().getName() != null) - { - out.println(" <filter name=\"" + filter.getConfig().getName() + "\">"); - } - else - { - out.println(" <filter class=\"" + filter.getConfig().getClassname() + "\">"); - } - - for (Object name : props.keySet()) - { - out.println(" <param name=\"" + name + "\" value=\"" + props.get(name) + "\"/>"); - } - out.println(" </filter>"); - } - } + saveFilter(filter.getConfig(), out, " "); } out.println(" </filters>"); } - + out.println(" </channel>"); out.println(); } } - + out.println(" </channels>"); out.println(); out.println("</tetrinet-channels>"); - + out.close(); } /** + * Write the configuration of the specified filter. + */ + private void saveFilter(FilterConfig filter, PrintWriter out, String indent) + { + Properties props = filter.getProperties(); + if (props == null || props.isEmpty()) + { + if (filter.getName() != null) + { + out.println(indent + "<filter name=\"" + filter.getName() + "\"/>"); + } + else + { + out.println(indent + "<filter class=\"" + filter.getClassname() + "\"/>"); + } + } + else + { + if (filter.getName() != null) + { + out.println(indent + "<filter name=\"" + filter.getName() + "\">"); + } + else + { + out.println(indent + "<filter class=\"" + filter.getClassname() + "\">"); + } + + for (Object name : props.keySet()) + { + out.println(indent + " <param name=\"" + name + "\" value=\"" + props.get(name) + "\"/>"); + } + out.println(indent + "</filter>"); + } + } + + /** * Locate the specified resource by searching in the classpath and in * the current directory. * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-02-28 23:54:53
|
Revision: 830 http://jetrix.svn.sourceforge.net/jetrix/?rev=830&view=rev Author: smanux Date: 2010-02-28 23:54:45 +0000 (Sun, 28 Feb 2010) Log Message: ----------- Relocated the nightly builds and updated the link to the forum Modified Paths: -------------- jetrix/trunk/src/site/faq.php jetrix/trunk/src/site/menu.inc.php Added Paths: ----------- jetrix/trunk/src/site/nightly/ jetrix/trunk/src/site/nightly/.htaccess Modified: jetrix/trunk/src/site/faq.php =================================================================== --- jetrix/trunk/src/site/faq.php 2010-02-25 23:10:29 UTC (rev 829) +++ jetrix/trunk/src/site/faq.php 2010-02-28 23:54:45 UTC (rev 830) @@ -3,7 +3,7 @@ <h1>Frequently Asked Questions</h1> Send your questions to <a href="mailto:sm...@lf...">sm...@lf...</a> or -post them on the <a href="http://sourceforge.net/forum/forum.php?forum_id=172941">forum</a> +post them on the <a href="http://sourceforge.net/projects/jetrix/forums/forum/172941">forum</a> <h3>How do I log on the administration console?</h3> Modified: jetrix/trunk/src/site/menu.inc.php =================================================================== --- jetrix/trunk/src/site/menu.inc.php 2010-02-25 23:10:29 UTC (rev 829) +++ jetrix/trunk/src/site/menu.inc.php 2010-02-28 23:54:45 UTC (rev 830) @@ -13,7 +13,7 @@ <ul> <li><a href="http://sourceforge.net/project/showfiles.php?group_id=52188">Binaries</a></li> <li><a href="http://jetrix.svn.sourceforge.net/viewvc/jetrix/">Source Code</a></li> - <li><a href="http://tetrinet.fr/jetrix/nightly/jetrix-@version@.tar.bz2">Nightly Build</a></li> + <li><a href="nightly/">Nightly Build</a></li> </ul> <h1>Documentation</h1> @@ -27,7 +27,7 @@ <h1>Project</h1> <ul> <li><a href="http://sourceforge.net/svn/?group_id=52188">SVN Repository</a></li> - <li><a href="https://sourceforge.net/projects/jetrix/forums/forum/172941">Forum</a></li> + <li><a href="http://sourceforge.net/projects/jetrix/forums/forum/172941">Forum</a></li> <li><a href="http://sourceforge.net/tracker/?group_id=52188&atid=466002">Bugs</a></li> <li><a href="http://sourceforge.net/tracker/?group_id=52188&atid=466005">Feature Requests</a></li> <li><a href="changelog.php">Changelog</a></li> Added: jetrix/trunk/src/site/nightly/.htaccess =================================================================== --- jetrix/trunk/src/site/nightly/.htaccess (rev 0) +++ jetrix/trunk/src/site/nightly/.htaccess 2010-02-28 23:54:45 UTC (rev 830) @@ -0,0 +1 @@ +Options +Indexes This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-02-25 23:10:35
|
Revision: 829 http://jetrix.svn.sourceforge.net/jetrix/?rev=829&view=rev Author: smanux Date: 2010-02-25 23:10:29 +0000 (Thu, 25 Feb 2010) Log Message: ----------- Tagging version 1.0 Added Paths: ----------- monitor/tags/1.0/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-02-24 00:36:30
|
Revision: 828 http://jetrix.svn.sourceforge.net/jetrix/?rev=828&view=rev Author: smanux Date: 2010-02-24 00:36:21 +0000 (Wed, 24 Feb 2010) Log Message: ----------- Added an atom feed with the latest servers submitted Modified Paths: -------------- monitor/trunk/pom.xml monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerInfoDao.java monitor/trunk/src/main/webapp/WEB-INF/classes/messages.properties monitor/trunk/src/main/webapp/WEB-INF/classes/messages_fr.properties monitor/trunk/src/main/webapp/index.jsp Added Paths: ----------- monitor/trunk/src/main/webapp/feed-servers.jsp Modified: monitor/trunk/pom.xml =================================================================== --- monitor/trunk/pom.xml 2010-02-24 00:33:46 UTC (rev 827) +++ monitor/trunk/pom.xml 2010-02-24 00:36:21 UTC (rev 828) @@ -133,6 +133,12 @@ <version>1.2</version> </dependency> + <dependency> + <groupId>rome</groupId> + <artifactId>rome</artifactId> + <version>0.9</version> + </dependency> + <!-- Needed for testing --> <dependency> <groupId>junit</groupId> Modified: monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerInfoDao.java =================================================================== --- monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerInfoDao.java 2010-02-24 00:33:46 UTC (rev 827) +++ monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerInfoDao.java 2010-02-24 00:36:21 UTC (rev 828) @@ -50,6 +50,17 @@ return getSession().createQuery("FROM ServerInfo ORDER BY stats.playerCount DESC, hostname").list(); } + /** + * Returns the latest servers added. + */ + public List<ServerInfo> getLatestServers(int n) + { + Query query = getSession().createQuery("FROM ServerInfo WHERE lastOnline != null ORDER BY dateAdded DESC"); + query.setMaxResults(n); + + return query.list(); + } + public void save(ServerInfo server) { getSession().saveOrUpdate(server); Modified: monitor/trunk/src/main/webapp/WEB-INF/classes/messages.properties =================================================================== --- monitor/trunk/src/main/webapp/WEB-INF/classes/messages.properties 2010-02-24 00:33:46 UTC (rev 827) +++ monitor/trunk/src/main/webapp/WEB-INF/classes/messages.properties 2010-02-24 00:36:21 UTC (rev 828) @@ -48,3 +48,6 @@ title.server = TetriNET Server - {0} title.player = TetriNET Player - {0} title.channel = TetriNET Channel - {0} on {1} + +feed.title = Latest TetriNET Servers +feed.description = The latest TetriNET servers submitted to the directory Modified: monitor/trunk/src/main/webapp/WEB-INF/classes/messages_fr.properties =================================================================== --- monitor/trunk/src/main/webapp/WEB-INF/classes/messages_fr.properties 2010-02-24 00:33:46 UTC (rev 827) +++ monitor/trunk/src/main/webapp/WEB-INF/classes/messages_fr.properties 2010-02-24 00:36:21 UTC (rev 828) @@ -48,3 +48,6 @@ title.server = Serveur TetriNET - {0} title.player = Joueur TetriNET - {0} title.channel = Channel TetriNET - {0} sur {1} + +feed.title = Les derniers serveurs TetriNET +feed.description = Les derniers serveurs TetriNET ajout\xE9s \xE0 la liste Added: monitor/trunk/src/main/webapp/feed-servers.jsp =================================================================== --- monitor/trunk/src/main/webapp/feed-servers.jsp (rev 0) +++ monitor/trunk/src/main/webapp/feed-servers.jsp 2010-02-24 00:36:21 UTC (rev 828) @@ -0,0 +1,45 @@ +<%@ page contentType="application/atom+xml" %> +<%@ page import="java.util.*" %> +<%@ page import="com.sun.syndication.feed.synd.*" %> +<%@ page import="com.sun.syndication.io.SyndFeedOutput" %> +<%@ page import="org.springframework.web.context.ContextLoader" %> +<%@ page import="org.springframework.web.context.WebApplicationContext" %> +<%@ page import="net.jetrix.monitor.ServerInfo" %> +<%@ page import="net.jetrix.monitor.dao.ServerInfoDao" %> +<% + WebApplicationContext context = ContextLoader.getCurrentWebApplicationContext(); + ServerInfoDao dao = (ServerInfoDao) context.getBean("serverInfoDao"); + + ResourceBundle bundle = ResourceBundle.getBundle("messages", request.getLocale()); + + String basePath = request.getRequestURI().substring(0, request.getRequestURI().lastIndexOf('/')); + + List<ServerInfo> servers = dao.getLatestServers(10); + + SyndFeed feed = new SyndFeedImpl(); + feed.setFeedType("atom_1.0"); + feed.setTitle(bundle.getString("feed.title")); + feed.setLink(basePath); + feed.setDescription(bundle.getString("feed.description")); + + List<SyndEntry> entries = new ArrayList<SyndEntry>(); + for (ServerInfo server : servers) { + SyndEntry entry = new SyndEntryImpl(); + entry.setTitle(server.getHostname()); + entry.setLink(basePath + "/server/" + server.getHostname()); + entry.setPublishedDate(server.getDateAdded()); + + SyndContent description = new SyndContentImpl(); + description.setType("text/plain"); + description.setValue(server.getVersion()); + + entry.setDescription(description); + entries.add(entry); + } + + feed.setEntries(entries); + + SyndFeedOutput output = new SyndFeedOutput(); + output.output(feed,response.getWriter()); + response.getWriter().flush(); +%> \ No newline at end of file Modified: monitor/trunk/src/main/webapp/index.jsp =================================================================== --- monitor/trunk/src/main/webapp/index.jsp 2010-02-24 00:33:46 UTC (rev 827) +++ monitor/trunk/src/main/webapp/index.jsp 2010-02-24 00:36:21 UTC (rev 828) @@ -35,6 +35,7 @@ <link rel="stylesheet" type="text/css" href="stylesheets/style.css"> <link rel="Shorcut Icon" href="favicon.ico"> <link rel="alternate" type="text/xml" title="Servers XML summary" href="servers.xml"> + <link rel="alternate" type="application/atom+xml" title="Latest TetriNET Servers" href="feed-servers.jsp" /> <script type="text/javascript" src="scripts/sortable.js"></script> </head> <body> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-02-24 00:33:57
|
Revision: 827 http://jetrix.svn.sourceforge.net/jetrix/?rev=827&view=rev Author: smanux Date: 2010-02-24 00:33:46 +0000 (Wed, 24 Feb 2010) Log Message: ----------- Rejects IPv6 address with no reverse name Modified Paths: -------------- monitor/trunk/src/main/webapp/server-add.jsp Modified: monitor/trunk/src/main/webapp/server-add.jsp =================================================================== --- monitor/trunk/src/main/webapp/server-add.jsp 2010-02-22 18:53:16 UTC (rev 826) +++ monitor/trunk/src/main/webapp/server-add.jsp 2010-02-24 00:33:46 UTC (rev 827) @@ -1,7 +1,5 @@ <%@ page import="java.io.IOException" %> -<%@ page import="java.net.InetAddress" %> -<%@ page import="java.net.InetSocketAddress" %> -<%@ page import="java.net.Socket" %> +<%@ page import="java.net.*" %> <%@ page import="java.util.Date" %> <%@ page import="net.jetrix.monitor.ServerInfo" %> <%@ page import="net.jetrix.monitor.dao.IpToCountryDao" %> @@ -29,6 +27,11 @@ return; } + if (address instanceof Inet6Address && address.getHostAddress().equals(address.getCanonicalHostName())) { + log.info("Server " + address.getHostAddress() + " not added: IPv6 address has no reverse name"); + return; + } + WebApplicationContext context = ContextLoader.getCurrentWebApplicationContext(); ServerInfoDao dao = (ServerInfoDao) context.getBean("serverInfoDao"); IpToCountryDao countryDao = (IpToCountryDao) context.getBean("ipToCountryDao"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2010-02-22 18:53:22
|
Revision: 826 http://jetrix.svn.sourceforge.net/jetrix/?rev=826&view=rev Author: smanux Date: 2010-02-22 18:53:16 +0000 (Mon, 22 Feb 2010) Log Message: ----------- Nice URL for the player page Modified Paths: -------------- monitor/trunk/src/main/webapp/WEB-INF/web.xml monitor/trunk/src/main/webapp/player.jsp monitor/trunk/src/main/webapp/server.jsp Modified: monitor/trunk/src/main/webapp/WEB-INF/web.xml =================================================================== --- monitor/trunk/src/main/webapp/WEB-INF/web.xml 2010-02-22 17:33:40 UTC (rev 825) +++ monitor/trunk/src/main/webapp/WEB-INF/web.xml 2010-02-22 18:53:16 UTC (rev 826) @@ -61,6 +61,16 @@ <url-pattern>/server/*</url-pattern> </servlet-mapping> + <servlet> + <servlet-name>player</servlet-name> + <jsp-file>/player.jsp</jsp-file> + </servlet> + + <servlet-mapping> + <servlet-name>player</servlet-name> + <url-pattern>/player/*</url-pattern> + </servlet-mapping> + <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> Modified: monitor/trunk/src/main/webapp/player.jsp =================================================================== --- monitor/trunk/src/main/webapp/player.jsp 2010-02-22 17:33:40 UTC (rev 825) +++ monitor/trunk/src/main/webapp/player.jsp 2010-02-22 18:53:16 UTC (rev 826) @@ -7,9 +7,18 @@ <% WebApplicationContext context = ContextLoader.getCurrentWebApplicationContext(); PlayerStatsDao dao = (PlayerStatsDao) context.getBean("playerStatsDao"); - - PlayerStats player = dao.getStats(request.getParameter("id")); - + + PlayerStats player = null; + if (request.getParameter("id") != null) { + player = dao.getStats(request.getParameter("id")); + } else if (request.getPathInfo() != null) { + player = dao.getStats(request.getPathInfo().substring(request.getPathInfo().lastIndexOf('/') + 1)); + } + + if (player == null) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST, "TetriNET player not found"); + return; + } %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> @@ -19,13 +28,12 @@ <fmt:param><%= StyleUtils.strip(player.getName()) %></fmt:param> </fmt:message> </title> - <link rel="stylesheet" type="text/css" href="stylesheets/style.css"> - <link rel="Shorcut Icon" href="favicon.ico"> + <link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/stylesheets/style.css"> + <link rel="Shorcut Icon" href="<%= request.getContextPath() %>/favicon.ico"> </head> <body> - <h1> <fmt:message key="title.player"> <fmt:param><%= StyleUtils.strip(player.getName()) %></fmt:param> @@ -47,7 +55,7 @@ </tr> <tr> <th><fmt:message key="word.server"/></th> - <td><a href="server.jsp?id=<%= player.getLastServer().getId() %>"><%= player.getLastServer().getHostname() %></a></td> + <td><a href="<%= request.getContextPath() %>/server/<%= player.getLastServer().getHostname() %>"><%= player.getLastServer().getHostname() %></a></td> </tr> <tr> <th><fmt:message key="word.channel"/></th> Modified: monitor/trunk/src/main/webapp/server.jsp =================================================================== --- monitor/trunk/src/main/webapp/server.jsp 2010-02-22 17:33:40 UTC (rev 825) +++ monitor/trunk/src/main/webapp/server.jsp 2010-02-22 18:53:16 UTC (rev 826) @@ -189,7 +189,7 @@ <tbody> <% for (PlayerInfo player : server.getPlayers()) { %> <tr> - <td<%= player.getAuthenticationLevel() > 1 ? " style=\"font-weight: bold\"" : "" %>><a style="text-decoration: none; color: black" href="<%= request.getContextPath() %>/player.jsp?id=<%= player.getNick() %>"><%= StyleUtils.toHTML(player.getNick()) %></a></td> + <td<%= player.getAuthenticationLevel() > 1 ? " style=\"font-weight: bold\"" : "" %>><a style="text-decoration: none; color: black" href="<%= request.getContextPath() %>/player/<%= player.getNick() %>"><%= StyleUtils.toHTML(player.getNick()) %></a></td> <td><%= StyleUtils.toHTML(player.getTeam()) %></td> <td><%= player.getChannel() %></td> <td><%= player.getSlot() %></td> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |