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

1
docs/VERSION.txt

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

2
mb.conf

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
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
Plugins XAMP, Monitor, Counterstrike, Win32X, Win32-Tray, Sound
Plugins XAMP, Monitor, Counterstrike, Win32X, Win32-Tray, Sound, Log
Port 5190
HeavyLogging 0
SoundsWhileAway 0

42
plugins/Log.pl

@ -16,31 +16,34 @@ register_hook("buddy_out", \&on_buddy_out); @@ -16,31 +16,34 @@ register_hook("buddy_out", \&on_buddy_out);
sub on_msg_in
{
my ($day, $month, $year, $hour, $min, $sec) = (localtime)[4, 3, 5, 2, 1, 0];
$year += 1900;
$month++;
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");
my ($hour, $min, $sec) = (localtime)[2,1,0];
log_item(user_log_file($ARGS{-user}), "<font color=\"blue\">" .
$ARGS{-user} . " ($hour:$min:$sec) " .
": $ARGS{-msg} </font><br>\n");
}
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
{
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
{
my ($day, $month, $year, $hour, $min, $sec) = (localtime)[4, 3, 5, 2, 1, 0];
$year += 1900;
$month++;
log_item("$logdir/$ARS{-user}/$day-$month-$year", data("me") . " ($day-$month-$year $hour:$min:$sec) " .
": $ARGS{-msg} \n");
my ($hour, $min, $sec) = (localtime)[2,1,0];
log_item(user_log_file($ARGS{-dest}), "<font color=\"red\">" .
data("me") . " ($hour:$min:$sec) " .
": $ARGS{-msg} </font><br>\n");
}
sub log_item
@ -52,4 +55,17 @@ sub log_item @@ -52,4 +55,17 @@ sub log_item
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;
return "$path/$month-$day-$year.html";
}
1;

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

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

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

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

Loading…
Cancel
Save