--- googlecode.com/svn/trunk/Meteor/Config.pm 2008/02/03 23:10:24 42 +++ googlecode.com/svn/trunk/Meteor/Config.pm 2008/02/04 19:02:49 45 @@ -63,6 +63,10 @@ 'Header template, ~server~, ~servertime~ and ~status~ will be replaced by the appropriate values. **NOTE**: It is possible to define more than one HeaderTemplate by appending a number at the end, for example *HeaderTemplate42*. Clients can request a specific header to be used by adding the parameter template= to their GET request. If *HeaderTemplate* is not found, the system will use the default HeaderTemplate (no number)', HeaderTemplate => 'HTTP/1.1 ~status~\r\nServer: ~server~\r\nContent-Type: text/html; charset=utf-8\r\nPragma: no-cache\r\nCache-Control: no-cache, no-store, must-revalidate\r\nExpires: Thu, 1 Jan 1970 00:00:00 GMT\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n', +'Template for each line in channelinfo', + + ChannelInfoTemplate => '~name~ ~messageCount~\r\n', + 'Print out this help message', Help => '', @@ -84,6 +88,10 @@ 'Interval at which PingMessage is sent to all persistent and identified subscriber connections (ie those including id=someuniqueidentifier in their request, and not specifying persist=0). Must be at least 3 if set higher than zero. Set to zero to disable.', PingInterval => 5, +'Persistence of a connection. Note: some modes have this hardcoded!', + + Persist => 0, + 'Message to be sent to all persistent and identified subscriber connections (see above) every PingInterval seconds', PingMessage => '\r\n', @@ -110,6 +118,7 @@ our %CommandLine=(); our %Defaults=(); our %ExtraKeys=(); + our %Modes=(); for(my $i=0;$i1 && $_[0]!~/^\-(?!\-)/) { my $param=shift; $param=~s/^\-\-/\-/; - $CommandLine{$key}=$param; + $CommandLine{"$key$mode"}=$param; } } @@ -285,6 +313,8 @@ my $path=$class->valueForKey('ConfigFileLocation'); return unless(defined($path) && -f $path); + my $mode=''; + open(CONFIG,"$path") or &usage("Config file '$path' for read: $!\n"); while() { @@ -293,6 +323,12 @@ s/[\r\n]*$//; + if(/^\s*\[\s*([^\]\s]+)\s*\]\s*$/) + { + $Modes{".$1"}=1; + next; + } + unless(/^(\S+)\s*(.*)/) { &usage("Invalid configuration file parameter line '$_'"); @@ -310,7 +346,7 @@ { unless(exists($Defaults{$key})) { - &usage("Unknown configuration file parameter name '$key'"); + &usage("Unknown configuration file parameter name '$key$mode'"); } if($key eq 'ConfigFileLocation') { @@ -320,7 +356,7 @@ $val=~s/^--/-/; - $ConfigFileData{$key}=$val; + $ConfigFileData{"$key$mode"}=$val; } close(CONFIG); } @@ -340,7 +376,7 @@ print STDERR <<"EOT"; -Meteor server v1.0 (release date: 1 Dec 2006) +Meteor server v$::VERSION (release date: $::RELEASE_DATE) Licensed under the terms of the GNU General Public Licence (2.0) Usage: