milkbone57 22 years ago
parent
commit
4b7bb49dcd
  1. 1
      docs/VERSION.txt
  2. 2
      mb.conf
  3. 50
      plugins/Log.pl
  4. 2
      plugins/Tk-Convo/Tk-Convo.pl
  5. 40
      plugins/Tk-GUI/Tk/BrowseEdit.pm

1
docs/VERSION.txt

@ -1,6 +1,7 @@
0.356 0.356
-- --
* Multiple stules in BrowseEdit
* More font-tweaking * More font-tweaking
* Fixed the %a - %s bug (thanks Dan) * Fixed the %a - %s bug (thanks Dan)
* A little more cleaning in XAMP * A little more cleaning in XAMP

2
mb.conf

@ -2,7 +2,7 @@
Goodbye sorry, gotta, go Goodbye sorry, gotta, go
Modules Tk-PluginsConf, Net-OSCAR, Tk-GUI, Tk-Logon, Tk-BList, Tk-Profile, Tk-File, Tk-About, Tk-Convo, Tk-Conf, Tk-AddBuddy Modules Tk-PluginsConf, Net-OSCAR, Tk-GUI, Tk-Logon, Tk-BList, Tk-Profile, Tk-File, Tk-About, Tk-Convo, Tk-Conf, Tk-AddBuddy
Plugins XAMP, Monitor, Counterstrike, Win32X, Win32-Tray, Sound Plugins XAMP, Monitor, Counterstrike, Win32X, Win32-Tray, Sound, Log
Port 5190 Port 5190
HeavyLogging 0 HeavyLogging 0
SoundsWhileAway 0 SoundsWhileAway 0

50
plugins/Log.pl

@ -16,40 +16,56 @@ register_hook("buddy_out", \&on_buddy_out);
sub on_msg_in sub on_msg_in
{ {
my ($day, $month, $year, $hour, $min, $sec) = (localtime)[4, 3, 5, 2, 1, 0]; my ($hour, $min, $sec) = (localtime)[2,1,0];
$year += 1900; log_item(user_log_file($ARGS{-user}), "<font color=\"blue\">" .
$month++; $ARGS{-user} . " ($hour:$min:$sec) " .
": $ARGS{-msg} </font><br>\n");
mkdir "$logdir/$ARS{-user}" unless -e "$logdir/$ARS{-user}/;
log_item("$logdir/$ARS{-user}/$day-$month-$year", $ARGS{-user} . " ($day-$month-$year $hour:$min:$sec) " .
": $ARGS{-msg} \n");
} }
sub on_buddy_in sub on_buddy_in
{ {
return unless -e user_file("log") . "/$ARGS{-buddy}";
my ($hour, $min, $sec) = (localtime)[2,1,0];
log_item(user_log_file($ARGS{-buddy}), "<font color=\"blue\">" .
$ARGS{-buddy} . " signed in at $hour:$min:$sec.</font><br>\n\n");
} }
sub on_buddy_out sub on_buddy_out
{ {
return unless -e user_log_file($ARGS{-buddy});
my ($hour, $min, $sec) = (localtime)[2,1,0];
log_item(user_log_file($ARGS{-buddy}), "<font color=\"blue\">" .
$ARGS{-buddy} . " signed out at $hour:$min:$sec.</font><br>\n\n");
} }
sub on_protocol_send_im sub on_protocol_send_im
{ {
my ($day, $month, $year, $hour, $min, $sec) = (localtime)[4, 3, 5, 2, 1, 0]; my ($hour, $min, $sec) = (localtime)[2,1,0];
$year += 1900; log_item(user_log_file($ARGS{-dest}), "<font color=\"red\">" .
$month++; data("me") . " ($hour:$min:$sec) " .
": $ARGS{-msg} </font><br>\n");
log_item("$logdir/$ARS{-user}/$day-$month-$year", data("me") . " ($day-$month-$year $hour:$min:$sec) " .
": $ARGS{-msg} \n");
} }
sub log_item sub log_item
{ {
my ($file, $text) = @_; my ($file, $text) = @_;
open(LOG, ">>$file");
print LOG $text;
close(LOG);
}
sub user_log_file
{
my ($user) = @_;
my ($month, $day, $year) = (localtime)[4, 3, 5];
$month++;
$year %= 100;
my $path = user_file("log/$user/");
mkpath $path;
open(LOG, ">>$file"); return "$path/$month-$day-$year.html";
print LOG $text;
close(LOG);
} }
1; 1;

2
plugins/Tk-Convo/Tk-Convo.pl

@ -10,6 +10,7 @@ use warnings;
my $mw = hook("tk_getmain"); my $mw = hook("tk_getmain");
my %convos; my %convos;
my $last_convo;
register_hook("create_convo", sub { register_hook("create_convo", sub {
my $buddy = $ARGS{-user}; my $buddy = $ARGS{-user};
@ -56,6 +57,7 @@ register_hook("create_convo", sub {
}); });
register_hook("remove_convo", sub { register_hook("remove_convo", sub {
i
deregister_hook("msg_in_$ARGS{-user}"); deregister_hook("msg_in_$ARGS{-user}");
deregister_hook("buddy_in_$ARGS{-user}"); deregister_hook("buddy_in_$ARGS{-user}");
deregister_hook("buddy_out_$ARGS{-user}"); deregister_hook("buddy_out_$ARGS{-user}");

40
plugins/Tk-GUI/Tk/BrowseEdit.pm

@ -1,15 +1,20 @@
package Tk::BrowseEdit; package Tk::BrowseEdit;
use Tk; use Tk;
use Tk::Font; use Tk::Font;
use base 'Tk::Frame'; use base 'Tk::Frame';
use strict; use strict;
use warnings; use warnings;
Construct Tk::Widget 'BrowseEdit'; Construct Tk::Widget 'BrowseEdit';
sub ClassInit sub ClassInit
{ {
my ($class, $mw) = @_; my ($class, $mw) = @_;
$class->SUPER::ClassInit($mw); $class->SUPER::ClassInit($mw);
} }
sub Populate sub Populate
{ {
my ($self, $args) = @_; my ($self, $args) = @_;
@ -48,7 +53,10 @@ $self]);
-font => $self->Font(-family => 'times', -size => '8'), -font => $self->Font(-family => 'times', -size => '8'),
-command => [sub { -command => [sub {
my ($self) = @_; my ($self) = @_;
$self->toggleTag('<u>'); my $color = $self->chooseColor(
-initialcolor => 'black', -parent => $self,
-title => 'Choose Background Color');
$self->toggleTag("<font back=\"$color\">", '<back>');
}, $self] }, $self]
)->pack(-pady => 0, -side => 'left', -fill => 'both'); )->pack(-pady => 0, -side => 'left', -fill => 'both');
$self->bind('<Control-U>', [sub { shift->{'<b>'}->invoke; }, $self]); $self->bind('<Control-U>', [sub { shift->{'<b>'}->invoke; }, $self]);
@ -63,13 +71,16 @@ $self]);
'to_html' => $self, 'to_html' => $self,
); );
} }
sub insert sub insert
{ {
shift->{text}->insert(@_); shift->{text}->insert(@_);
} }
sub toggleTag sub toggleTag
{ {
my ($self, $tag) = @_; my ($self, $tag, $button) = @_;
$button = defined($button) ? $button : $tag;
if(!defined($self->{text}->tagRanges('sel'))) if(!defined($self->{text}->tagRanges('sel')))
{ {
# no selection - modify current position # no selection - modify current position
@ -88,7 +99,7 @@ sub toggleTag
print "tag created\n"; print "tag created\n";
$self->insert('insert', '%%%ignore%%%', [$cur_tag, 'elide']); $self->insert('insert', '%%%ignore%%%', [$cur_tag, 'elide']);
$self->tagAdd($cur_tag, 'insert'); $self->tagAdd($cur_tag, 'insert');
$self->{$tag}->configure(-relief => 'flat'); $self->{$button}->configure(-relief => 'flat');
print "done\n"; print "done\n";
} }
else else
@ -99,11 +110,16 @@ sub toggleTag
$self->create_tag($cur_tag); $self->create_tag($cur_tag);
$self->insert('insert', '%%%ignore%%%', [$cur_tag, 'elide']); $self->insert('insert', '%%%ignore%%%', [$cur_tag, 'elide']);
$self->tagAdd($cur_tag, 'insert'); $self->tagAdd($cur_tag, 'insert');
$self->{$tag}->configure(-relief => 'sunken'); $self->{$button}->configure(-relief => 'sunken');
} }
} }
else else
{ {
my $removed;
my $new_tag;
for my $wholetag ($self->{text}->tagNames())
{
next unless $wholetag =~ /$tag/;
my ($selstart, $selend) = $self->{text}->tagRanges('sel'); my ($selstart, $selend) = $self->{text}->tagRanges('sel');
my @tags = $self->{text}->tagRanges($tag); my @tags = $self->{text}->tagRanges($tag);
my (@starts, @ends); my (@starts, @ends);
@ -118,16 +134,24 @@ sub toggleTag
{ {
if($selstart >= $start and $selend <= $end) if($selstart >= $start and $selend <= $end)
{ {
$self->{text}->tagRemove($tag, $self->{text}->tagRanges('sel')); $new_tag .= $tag;
$self->{$tag}->configure(-relief => 'flat'); $self->{$tag}->configure(-relief => 'flat');
return; $removed = 1;
return;
} }
} }
} }
$self->{text}->tagAdd($tag, $self->{text}->tagRanges('sel')); }
unless($removed)
{
$self->create_tag($new_tag);
$self->{text}->tagAdd($tag, $self->{text}->tagRanges('sel'));
$self->{$tag}->configure(-relief => 'sunken'); $self->{$tag}->configure(-relief => 'sunken');
}
} }
} }
sub create_tag sub create_tag
{ {
my ($self, $tag) = @_; my ($self, $tag) = @_;

Loading…
Cancel
Save