/[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 25 by knops.gerd, Sun May 20 19:40:53 2007 UTC revision 45 by knops.gerd, Mon Feb 4 19:02:49 2008 UTC
# Line 77  sub listChannels { Line 77  sub listChannels {
77          $list;          $list;
78  }  }
79    
80    sub listChannelsUsingTemplate {
81            my $class=shift;
82            my $template=shift;
83            
84            return '' unless(defined($template) && $template ne '');
85            
86            my $list='';
87            foreach my $channelName (sort keys %Channels)
88            {
89                    my $channel=$Channels{$channelName};
90                    
91                    $list.=$channel->descriptionWithTemplate($template);
92            }
93            
94            $list;
95    }
96    
97  sub deleteChannel {  sub deleteChannel {
98          my $class=shift;          my $class=shift;
99          my $channelName=shift;          my $channelName=shift;
# Line 165  sub addSubscriber { Line 182  sub addSubscriber {
182                    
183          $startIndex=0 if($startIndex<0);          $startIndex=0 if($startIndex<0);
184                    
185          my $numMsgToSend=0;          if($startIndex<$msgCount)
         while($startIndex<$msgCount)  
186          {          {
187                  my $message=$self->{'messages'}->[$startIndex++];                  $subscriber->sendMessages(@{$self->{'messages'}}[$startIndex,$msgCount-1]);
                   
                 $txt.=$message->message();  
                 $numMsgToSend++;  
188          }          }
           
         $subscriber->sendMessage($txt,$numMsgToSend);  
189  }  }
190    
191  sub removeSubscriber {  sub removeSubscriber {
# Line 216  sub addMessage { Line 227  sub addMessage {
227                    
228          $self->trimMessageStoreBySize();          $self->trimMessageStoreBySize();
229                    
230          my $text=$message->message();          map { $_->sendMessages($message) } @{$self->{'subscribers'}};
         map { $_->sendMessage($text) } @{$self->{'subscribers'}};  
231  }  }
232    
233  sub messageCount {  sub messageCount {
# Line 317  sub indexForMessageID { Line 327  sub indexForMessageID {
327          return $low;          return $low;
328  }  }
329    
330    sub descriptionWithTemplate {
331            my $self=shift;
332            my $template=shift;
333            
334            $template=~s/~([a-zA-Z0-9_]*)~/
335                    if(!defined($1) || $1 eq '')
336                    {
337                            '~';
338                    }
339                    elsif($1 eq 'messageCount')
340                    {
341                            $self->messageCount();
342                    }
343                    elsif($1 eq 'subscriberCount')
344                    {
345                            $self->subscriberCount();
346                    }
347                    elsif(exists($self->{$1}))
348                    {
349                            $self->{$1};
350                    }
351                    else
352                    {
353                            '';
354                    }
355            /gex;
356            
357            $template;
358    }
359    
360  1;  1;
361  ############################################################################EOF  ############################################################################EOF

Legend:
Removed from v.25  
changed lines
  Added in v.45

  ViewVC Help
Powered by ViewVC 1.1.26