Changeset 864ed35 for perlwrap.pm
- Timestamp:
- Apr 29, 2008, 1:21:13 AM (16 years ago)
- Branches:
- master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- b67ab6b
- Parents:
- 120291c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perlwrap.pm
r9815e2e r864ed35 702 702 if(*BarnOwl::format_msg{CODE}) { 703 703 # if the config defines a legacy formatting function, add 'perl' as a style 704 BarnOwl::_create_style("perl", "BarnOwl::_format_msg_legacy_wrap",705 "User-defined perl style that calls BarnOwl::format_msg"706 . " with legacy global variable support");707 BarnOwl::set("-q default_style perl");704 # BarnOwl::_create_style("perl", "BarnOwl::_format_msg_legacy_wrap", 705 # "User-defined perl style that calls BarnOwl::format_msg" 706 # . " with legacy global variable support"); 707 # BarnOwl::set("-q default_style perl"); 708 708 } 709 709 } … … 763 763 sub format_message($) 764 764 { 765 my $self = shift; 765 766 my $m = shift; 766 767 767 768 if ( $m->is_loginout) { 768 return format_login($m);769 return $self->format_login($m); 769 770 } elsif($m->is_ping && $m->is_personal) { 770 return ( "\@b(PING) from \@b(" . $m->pretty_sender . ")\n");771 return $self->format_ping($m); 771 772 } elsif($m->is_admin) { 772 return "\@bold(OWL ADMIN)\n" . indentBody($m);773 return $self->format_admin($m); 773 774 } else { 774 return format_chat($m);775 return $self->format_chat($m); 775 776 } 776 777 } 777 778 778 BarnOwl::_create_style("default", "BarnOwl::Style::Default::format_message", "Default style"); 779 sub description {"Default style";} 780 781 BarnOwl::_create_style("default", "BarnOwl::Style::Default"); 779 782 780 783 ################################################################################ … … 787 790 788 791 sub format_login($) { 792 my $self = shift; 789 793 my $m = shift; 790 794 return sprintf( … … 798 802 } 799 803 804 sub format_ping { 805 my $self = shift; 806 my $m = shift; 807 return "\@b(PING) from \@b(" . $m->pretty_sender . ")\n"; 808 } 809 810 sub format_admin { 811 my $self = shift; 812 my $m = shift; 813 return "\@bold(OWL ADMIN)\n" . indentBody($m); 814 } 815 800 816 sub format_chat($) { 817 my $self = shift; 801 818 my $m = shift; 802 819 my $header; … … 846 863 } 847 864 865 package BarnOwl::Style::Basic; 866 867 our @ISA=qw(BarnOwl::Style::Default); 868 869 sub description {"Compatability alias for the default style";} 870 871 BarnOwl::_create_style("basic", "BarnOwl::Style::Basic"); 872 848 873 package BarnOwl::Style::OneLine; 849 874 ################################################################################ … … 852 877 use constant BASE_FORMAT => '%s %-13.13s %-11.11s %-12.12s '; 853 878 sub format_message($) { 879 my $self = shift; 854 880 my $m = shift; 855 881 856 # if ( $m->is_zephyr ) {857 # return format_zephyr($m);858 # }859 882 if ( $m->is_loginout ) { 860 return format_login($m);883 return $self->format_login($m); 861 884 } 862 885 elsif ( $m->is_ping) { 863 return format_ping($m);886 return $self->format_ping($m); 864 887 } 865 888 elsif ( $m->is_admin || $m->is_loopback) { 866 return format_local($m);889 return $self->format_local($m); 867 890 } 868 891 else { 869 return format_chat($m);892 return $self->format_chat($m); 870 893 } 871 894 } 872 895 873 BarnOwl::_create_style("oneline", "BarnOwl::Style::OneLine::format_message", "Formats for one-line-per-message"); 896 sub description {"Formats for one-line-per-message"} 897 898 BarnOwl::_create_style("oneline", "BarnOwl::Style::OneLine"); 874 899 875 900 ################################################################################ 876 901 877 902 sub format_login($) { 903 my $self = shift; 878 904 my $m = shift; 879 905 return sprintf( … … 898 924 sub format_chat($) 899 925 { 926 my $self = shift; 900 927 my $m = shift; 901 928 my $dir = lc($m->{direction}); … … 938 965 sub format_local($) 939 966 { 967 my $self = shift; 940 968 my $m = shift; 941 969 my $type = uc($m->{type});
Note: See TracChangeset
for help on using the changeset viewer.