/[meteor]/googlecode.com/svn/trunk/Meteor/Channel.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/Channel.pm

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

revision 50 by andrew.betts, Wed Feb 27 13:55:35 2008 UTC revision 62 by andrew.betts, Thu Nov 27 00:33:21 2008 UTC
# Line 4  Line 4 
4  #   An HTTP server for the 2.0 web  #   An HTTP server for the 2.0 web
5  #   Copyright (c) 2006 contributing authors  #   Copyright (c) 2006 contributing authors
6  #  #
7  #   Subscriber.pm  #   Channel.pm
8  #  #
9  #       Description:  #       Description:
10  #       A Meteor Channel  #       A Meteor Channel
# Line 77  sub listChannels { Line 77  sub listChannels {
77          $list;          $list;
78  }  }
79    
 sub listChannelsUsingTemplate {  
         my $class=shift;  
         my $template=shift;  
           
         return '' unless(defined($template) && $template ne '');  
           
         my $list='';  
         foreach my $channelName (sort keys %Channels)  
         {  
                 my $channel=$Channels{$channelName};  
                   
                 $list.=$channel->descriptionWithTemplate($template);  
         }  
           
         $list;  
 }  
   
80  sub deleteChannel {  sub deleteChannel {
81          my $class=shift;          my $class=shift;
82          my $channelName=shift;          my $channelName=shift;
# Line 180  sub addSubscriber { Line 163  sub addSubscriber {
163                    
164          &::syslog('info','',          &::syslog('info','',
165                  'joinchannel',                  'joinchannel',
166                  $subscriber->{'subscriberID'},                  $subscriber->{'socketFN'},
167                  $self->{'name'},                  $self->{'name'},
168                  $mode,                  $logStartIndex
                 $logStartIndex,  
                 $userAgent  
169          );          );
170                    
171          return unless(defined($startIndex));          return unless(defined($startIndex));
# Line 206  sub removeSubscriber { Line 187  sub removeSubscriber {
187                    
188          my $idx=undef;          my $idx=undef;
189          my $numsubs = scalar(@{$self->{'subscribers'}});          my $numsubs = scalar(@{$self->{'subscribers'}});
190          for(my $i=0;$i<$numsubs;$i++)  
191          {          for (my $i=0; $i<$numsubs; $i++) {
192                  if($self->{'subscribers'}->[$i]==$subscriber)                  if($self->{'subscribers'}->[$i]==$subscriber) {
                 {  
193                          $idx=$i;                          $idx=$i;
194                          last;                          last;
195                  }                  }
# Line 219  sub removeSubscriber { Line 199  sub removeSubscriber {
199          {          {
200                  splice(@{$self->{'subscribers'}},$idx,1);                  splice(@{$self->{'subscribers'}},$idx,1);
201                                    
202                  my $timeConnected = time - $subscriber->{'ConnectionStart'};                  my $timeConnected = time - $subscriber->{'connectionStart'};
203                  &::syslog('info','',                  &::syslog('info','',
204                          'leavechannel',                          'leavechannel',
205                            $subscriber->{'ip'},
206                          $subscriber->{'subscriberID'},                          $subscriber->{'subscriberID'},
207                          $self->{'name'},                          $self->{'name'},
208                          $timeConnected,                          $timeConnected,
209                          $subscriber->{'MessageCount'},                          $subscriber->{'messageCount'},
210                          $subscriber->{'bytesWritten'},                          $subscriber->{'bytesWritten'},
211                          $reason                          $reason
212                  );                  );
# Line 365  sub descriptionWithTemplate { Line 346  sub descriptionWithTemplate {
346          my $self=shift;          my $self=shift;
347          my $template=shift;          my $template=shift;
348                    
349            return '' unless(defined($template) && $template ne '');
350            
351          $template=~s/~([a-zA-Z0-9_]*)~/          $template=~s/~([a-zA-Z0-9_]*)~/
352                  if(!defined($1) || $1 eq '') {                  if(!defined($1) || $1 eq '') {
353                          '~';                          '~';
# Line 373  sub descriptionWithTemplate { Line 356  sub descriptionWithTemplate {
356                  } elsif($1 eq 'subscriberCount') {                  } elsif($1 eq 'subscriberCount') {
357                          $self->subscriberCount();                          $self->subscriberCount();
358                  } elsif($1 eq 'lastMsgID') {                  } elsif($1 eq 'lastMsgID') {
359                          $self->lastMsgID();                          $self->lastMsgID() || 1;
360                  } elsif($1 eq 'name') {                  } elsif($1 eq 'name') {
361                          $self->{'name'};                          $self->{'name'};
362                  } else {                  } else {

Legend:
Removed from v.50  
changed lines
  Added in v.62

  ViewVC Help
Powered by ViewVC 1.1.26