/[meteor]/googlecode.com/svn/trunk/Meteor/Subscriber.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /googlecode.com/svn/trunk/Meteor/Subscriber.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 52 by andrew.betts, Wed Feb 27 14:05:59 2008 UTC revision 53 by andrew.betts, Wed Feb 27 21:58:56 2008 UTC
# Line 167  sub processLine { Line 167  sub processLine {
167                                  $PersistentConnections{$self->{'subscriberID'}}=$self;                                  $PersistentConnections{$self->{'subscriberID'}}=$self;
168                          }                          }
169                                                    
170                          if(scalar(keys %{$channels}))                          if(scalar(keys %{$channels})) {
171                          {  
172                                    $self->{'channelinfo'} = '';
173                                    my $citemplate = $self->getConf('ChannelInfoTemplate');
174                                    foreach $channelName (keys %{$channels}) {
175                                            my $channel=Meteor::Channel->channelWithName($channelName);
176                                            $self->{'channels'}->{$channelName}=$channel;
177                                            $self->{'channelinfo'} .= $channel->descriptionWithTemplate($citemplate);
178                                            
179                                    }
180                                  $self->emitOKHeader();                                  $self->emitOKHeader();
181                                  $self->setChannels($channels,$persist,$self->{'mode'},$useragent);                                  foreach $channelName (keys %{$channels}) {
182                                            my $startIndex=$channels->{$channelName}->{'startIndex'};
183                                            $self->{'channels'}->{$channelName}->addSubscriber($self,$startIndex,$persist,$self->{'mode'},$useragent);
184                                    }
185                                    delete ($self->{'channels'}) unless($persist);
186                                  $self->close(1, 'responseComplete') unless($persist);                                  $self->close(1, 'responseComplete') unless($persist);
187                                  return;                                  return;
188                          }                          }
# Line 196  sub processLine { Line 208  sub processLine {
208          }          }
209  }  }
210    
 sub setChannels {  
         my $self=shift;  
         my $channels=shift;  
         my $persist=shift;  
         my $mode=shift || '';  
         my $userAgent=shift || '';  
           
         foreach my $channelName (keys %{$channels})  
         {  
                 my $startIndex=$channels->{$channelName}->{'startIndex'};  
                   
                 my $channel=Meteor::Channel->channelWithName($channelName);  
                   
                 $self->{'channels'}->{$channelName}=$channel if($persist);  
                   
                 $channel->addSubscriber($self,$startIndex,$persist,$mode,$userAgent);  
         }  
 }  
   
211  sub emitOKHeader {  sub emitOKHeader {
212          my $self=shift;          my $self=shift;
213                    
# Line 238  sub emitHeader { Line 231  sub emitHeader {
231          my $header=$self->getConf('HeaderTemplate');          my $header=$self->getConf('HeaderTemplate');
232                    
233          $header=~s/~([^~]*)~/          $header=~s/~([^~]*)~/
234                  if(!defined($1) || $1 eq '')                  if(!defined($1) || $1 eq '') {
                 {  
235                          '~';                          '~';
236                  }                  } elsif($1 eq 'server') {
                 elsif($1 eq 'server')  
                 {  
237                          $::PGM;                          $::PGM;
238                  }                  } elsif($1 eq 'status') {
                 elsif($1 eq 'status')  
                 {  
239                          $status;                          $status;
240                  }                  } elsif($1 eq 'servertime') {
                 elsif($1 eq 'servertime')  
                 {  
241                          time;                          time;
242                  }                  } elsif($1 eq 'channelinfo') {
243                  elsif($1 eq 'channelinfo')                          $self->{'channelinfo'};
244                  {                  } else {
                         Meteor::Channel->listChannelsUsingTemplate($self->getConf('ChannelInfoTemplate'));  
                 }  
                 else  
                 {  
245                          '';                          '';
246                  }                  }
247          /gex;          /gex;

Legend:
Removed from v.52  
changed lines
  Added in v.53

  ViewVC Help
Powered by ViewVC 1.1.26