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 |
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; |
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)); |
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 |
} |
} |
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 |
); |
); |
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 |
'~'; |
'~'; |
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 { |