diff -r 4b2c8bedb094 -r 60c237bb677a org/sonews/daemon/command/XDaemonCommand.java --- a/org/sonews/daemon/command/XDaemonCommand.java Mon Aug 24 14:40:37 2009 +0200 +++ b/org/sonews/daemon/command/XDaemonCommand.java Sat May 01 18:51:57 2010 +0200 @@ -66,6 +66,21 @@ return false; } + private void channelAdd(String[] commands, NNTPConnection conn) + throws IOException, StorageBackendException + { + String groupName = commands[2]; + if(StorageManager.current().isGroupExisting(groupName)) + { + conn.println("400 group " + groupName + " already existing!"); + } + else + { + StorageManager.current().addGroup(groupName, Integer.parseInt(commands[3])); + conn.println("200 group " + groupName + " created"); + } + } + // TODO: Refactor this method to reduce complexity! @Override public void processLine(NNTPConnection conn, String line, byte[] raw) @@ -119,8 +134,7 @@ } else if(commands.length == 4 && commands[1].equalsIgnoreCase("GROUPADD")) { - StorageManager.current().addGroup(commands[2], Integer.parseInt(commands[3])); - conn.println("200 group " + commands[2] + " created"); + channelAdd(commands, conn); } else if(commands.length == 3 && commands[1].equalsIgnoreCase("GROUPDEL")) {