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; |
116 |
map { $_->clearBuffer() } (values %Channels); |
map { $_->clearBuffer() } (values %Channels); |
117 |
} |
} |
118 |
|
|
119 |
|
sub numChannels { |
120 |
|
|
121 |
|
return scalar(keys %Channels); |
122 |
|
} |
123 |
|
|
124 |
############################################################################### |
############################################################################### |
125 |
# Factory methods |
# Factory methods |
126 |
############################################################################### |
############################################################################### |
182 |
|
|
183 |
$startIndex=0 if($startIndex<0); |
$startIndex=0 if($startIndex<0); |
184 |
|
|
185 |
while($startIndex<$msgCount) |
if($startIndex<$msgCount) |
186 |
{ |
{ |
187 |
my $message=$self->{'messages'}->[$startIndex++]; |
$subscriber->sendMessages(@{$self->{'messages'}}[$startIndex,$msgCount-1]); |
|
|
|
|
$txt.=$message->message(); |
|
188 |
} |
} |
|
|
|
|
$subscriber->sendMessage($txt); |
|
189 |
} |
} |
190 |
|
|
191 |
sub removeSubscriber { |
sub removeSubscriber { |
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 { |
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 |