Changes in / [c55ad84:b7b4565]
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
README
r6933082 r6824a76 28 28 We plan to soon add targets to the Makefile to check for and install 29 29 these for you. 30 31 The IRC module requires: 32 33 Net::IRC 34 Class::Accessor -
editwin.c
rfac5463 rcc6f009 198 198 int dotsend=e->dotsend; 199 199 char *locktext=NULL; 200 char echochar=e->echochar; 200 201 201 202 lock=0; … … 216 217 if (dotsend) { 217 218 owl_editwin_set_dotsend(e); 219 } 220 if (echochar) { 221 owl_editwin_set_echochar(e, echochar); 218 222 } 219 223 -
owl.c
r0b7082c rf2d72128 262 262 owl_style_create_internal(s, "basic", &owl_stylefunc_basic, "Basic message formatting."); 263 263 owl_global_add_style(&g, s); 264 s=owl_malloc(sizeof(owl_style));265 owl_style_create_internal(s, "oneline", &owl_stylefunc_oneline, "Formats for one-line-per-message");266 owl_global_add_style(&g, s);267 264 268 265 /* setup the default filters */ -
perl/modules/IRC/lib/BarnOwl/Message/IRC.pm
r2fb58e4 r1fd5041b 56 56 sub long_sender {shift->{from} || ""}; 57 57 58 sub login_type { 59 my $self = shift; 60 return " (" . ($self->is_login ? "JOIN" : "PART") . ")"; 61 } 62 58 63 sub login_extra { shift->channel; } 59 64 -
perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
rfe8cad8 r56e72d5 104 104 BarnOwl::new_command('irc-names' => \&cmd_names); 105 105 BarnOwl::new_command('irc-whois' => \&cmd_whois); 106 BarnOwl::new_command('irc-motd' => \&cmd_motd); 106 107 } 107 108 … … 245 246 } 246 247 248 sub cmd_motd { 249 my $cmd = shift; 250 my $conn = get_connection(\@_); 251 $conn->motd; 252 } 253 247 254 ################################################################################ 248 255 ########################### Utilities/Helpers ################################## … … 256 263 } 257 264 my $channel = $args->[-1]; 258 if ($channel =~ /^#/ and $channels{$channel} and @{$channels{$channel}} == 1) { 265 if (defined($channel) && $channel =~ /^#/ 266 and $channels{$channel} and @{$channels{$channel}} == 1) { 259 267 return $channels{$channel}[0]; 260 268 } -
perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
r9e02bb7 reab7a4c 16 16 17 17 use base qw(Net::IRC::Connection Class::Accessor Exporter); 18 __PACKAGE__->mk_accessors(qw(alias channels motd));18 __PACKAGE__->mk_accessors(qw(alias channels owl_connected owl_motd)); 19 19 our @EXPORT_OK = qw(&is_private); 20 20 … … 29 29 $self->alias($alias); 30 30 $self->channels([]); 31 $self->motd(""); 31 $self->owl_motd(""); 32 $self->owl_connected(0); 32 33 bless($self, $class); 33 34 34 35 $self->add_default_handler(sub { goto &on_event; }); 35 $self->add_handler(376 => sub { goto &on_connect });36 36 $self->add_handler(['msg', 'notice', 'public', 'caction'], 37 37 sub { goto &on_msg }); … … 57 57 ############################### IRC callbacks ################################## 58 58 ################################################################################ 59 60 sub on_connect {61 my ($self, $evt) = @_;62 BarnOwl::admin_message("IRC", "Connected to " . $self->server . " (" . $self->alias . ")");63 }64 59 65 60 sub new_message { … … 115 110 sub on_motdstart { 116 111 my ($self, $evt) = @_; 117 $self-> motd(join "\n", cdr $evt->args);112 $self->owl_motd(join "\n", cdr $evt->args); 118 113 } 119 114 120 115 sub on_motd { 121 116 my ($self, $evt) = @_; 122 $self-> motd(join "\n", $self->motd, cdr $evt->args);117 $self->owl_motd(join "\n", $self->owl_motd, cdr $evt->args); 123 118 } 124 119 125 120 sub on_endofmotd { 126 121 my ($self, $evt) = @_; 127 $self->motd(join "\n", $self->motd, cdr $evt->args); 128 BarnOwl::admin_message("IRC", 129 BarnOwl::Style::boldify('MOTD for ' . $evt->alias) . "\n" 130 . strip_irc_formatting($self->motd)); 122 $self->owl_motd(join "\n", $self->owl_motd, cdr $evt->args); 123 if(!$self->owl_connected) { 124 BarnOwl::admin_message("IRC", "Connected to " . 125 $self->server . " (" . $self->alias . ")"); 126 $self->owl_connected(1); 127 128 } 129 BarnOwl::admin_message("IRC", 130 BarnOwl::Style::boldify('MOTD for ' . $self->alias) . "\n" 131 . strip_irc_formatting($self->owl_motd)); 131 132 } 132 133 … … 162 163 "[" . $self->alias . "] " . 163 164 [$evt->args]->[1] . ": Nick already in use"); 165 unless($self->owl_connected) { 166 $self->disconnect; 167 } 164 168 } 165 169 -
perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
r892568b r05f0061 370 370 371 371 if ( !@result || $result[0] ne 'ok' ) { 372 if ( !$vars{jlogin_havepass} && ( !@result || $result[0] eq '401' ) ) {372 if ( !$vars{jlogin_havepass} && ( !@result || $result[0] eq '401' || $result[0] eq 'error') ) { 373 373 $vars{jlogin_havepass} = 1; 374 374 $conn->removeConnection($jidStr); -
perlconfig.c
r5376a95 rff13a6f 482 482 void owl_perlconfig_cmd_free(owl_cmd *cmd) 483 483 { 484 SvREFCNT_dec(cmd );484 SvREFCNT_dec(cmd->cmd_perl); 485 485 } 486 486 -
perlwrap.pm
rb0c8011 rf2d72128 831 831 # newline plus four spaces and that thing. 832 832 $body =~ s/\n(.)/\n $1/g; 833 833 # Trim trailing newlines. 834 $body =~ s/\n*$//; 834 835 return " ".$body; 835 836 } 836 837 838 package BarnOwl::Style::OneLine; 839 ################################################################################ 840 # Branching point for various formatting functions in this style. 841 ################################################################################ 842 use constant BASE_FORMAT => '%s %-13.13s %-11.11s %-12.12s '; 843 sub format_message($) { 844 my $m = shift; 845 846 # if ( $m->is_zephyr ) { 847 # return format_zephyr($m); 848 # } 849 if ( $m->is_login ) { 850 return format_login($m); 851 } 852 elsif ( $m->is_ping) { 853 return format_ping($m); 854 } 855 elsif ( $m->is_admin || $m->is_loopback) { 856 return format_local($m); 857 } 858 else { 859 return format_chat($m); 860 } 861 } 862 863 BarnOwl::_create_style("oneline", "BarnOwl::Style::OneLine::format_message", "Formats for one-line-per-message"); 864 865 ################################################################################ 866 867 sub format_login($) { 868 my $m = shift; 869 return sprintf( 870 BASE_FORMAT, 871 '<', 872 $m->type, 873 uc( $m->login ), 874 $m->pretty_sender) 875 . ($m->login_extra ? "at ".$m->login_extra : ''); 876 } 877 878 sub format_ping($) { 879 my $m = shift; 880 return sprintf( 881 BASE_FORMAT, 882 '<', 883 $m->type, 884 'PING', 885 $m->pretty_sender) 886 } 887 888 sub format_chat($) 889 { 890 my $m = shift; 891 my $dir = lc($m->{direction}); 892 my $dirsym = '-'; 893 if ($dir eq 'in') { 894 $dirsym = '<'; 895 } 896 elsif ($dir eq 'out') { 897 $dirsym = '>'; 898 } 899 900 my $line; 901 if ($m->is_personal) { 902 $line= sprintf(BASE_FORMAT, 903 $dirsym, 904 $m->type, 905 '', 906 ($dir eq 'out' 907 ? $m->pretty_recipient 908 : $m->pretty_sender)); 909 } 910 else { 911 $line = sprintf(BASE_FORMAT, 912 $dirsym, 913 $m->context, 914 $m->subcontext, 915 ($dir eq 'out' 916 ? $m->pretty_recipient 917 : $m->pretty_sender)); 918 } 919 920 my $body = $m->{body}; 921 $body =~ tr/\n/ /; 922 $line .= $body; 923 $line = BarnOwl::Style::boldify($line) if ($m->is_personal && lc($m->direction) eq 'in'); 924 return $line; 925 } 926 927 # Format locally generated messages 928 sub format_local($) 929 { 930 my $m = shift; 931 my $type = uc($m->{type}); 932 my $line = sprintf(BASE_FORMAT, '<', $type, '', ''); 933 my $body = $m->{body}; 934 $body =~ tr/\n/ /; 935 return $line.$body; 936 } 837 937 838 938 package BarnOwl::Style; -
stylefunc.c
r0b7082c rf2d72128 220 220 } 221 221 } 222 223 void owl_stylefunc_oneline(owl_fmtext *fm, owl_message *m)224 {225 char *tmp;226 char *baseformat="%s %-13.13s %-11.11s %-12.12s ";227 char *sender, *recip;228 #ifdef HAVE_LIBZEPHYR229 ZNotice_t *n;230 #endif231 232 sender=short_zuser(owl_message_get_sender(m));233 recip=short_zuser(owl_message_get_recipient(m));234 235 if (owl_message_is_type_zephyr(m)) {236 #ifdef HAVE_LIBZEPHYR237 n=owl_message_get_notice(m);238 239 owl_fmtext_append_spaces(fm, OWL_TAB);240 241 if (owl_message_is_loginout(m)) {242 char *host, *tty;243 244 host=owl_message_get_attribute_value(m, "loginhost");245 tty=owl_message_get_attribute_value(m, "logintty");246 247 if (owl_message_is_login(m)) {248 tmp=owl_sprintf(baseformat, "<", owl_message_is_pseudo(m)?"LOGIN-P":"LOGIN", "", sender);249 owl_fmtext_append_normal(fm, tmp);250 owl_free(tmp);251 } else if (owl_message_is_logout(m)) {252 tmp=owl_sprintf(baseformat, "<", owl_message_is_pseudo(m)?"LOGOUT-P":"LOGOUT", "", sender);253 owl_fmtext_append_normal(fm, tmp);254 owl_free(tmp);255 }256 257 owl_fmtext_append_normal(fm, "at ");258 owl_fmtext_append_normal(fm, host ? host : "");259 owl_fmtext_append_normal(fm, " ");260 owl_fmtext_append_normal(fm, tty ? tty : "");261 owl_fmtext_append_normal(fm, "\n");262 263 } else if (owl_message_is_ping(m)) {264 tmp=owl_sprintf(baseformat, "<", "PING", "", sender);265 owl_fmtext_append_normal(fm, tmp);266 owl_fmtext_append_normal(fm, "\n");267 owl_free(tmp);268 269 } else {270 if (owl_message_is_direction_in(m)) {271 tmp=owl_sprintf(baseformat, "<", owl_message_get_class(m), owl_message_get_instance(m), sender);272 } else if (owl_message_is_direction_out(m)) {273 tmp=owl_sprintf(baseformat, ">", owl_message_get_class(m), owl_message_get_instance(m), recip);274 } else {275 tmp=owl_sprintf(baseformat, "-", owl_message_get_class(m), owl_message_get_instance(m), sender);276 }277 owl_fmtext_append_normal(fm, tmp);278 if (tmp) owl_free(tmp);279 280 tmp=owl_strdup(owl_message_get_body(m));281 owl_text_tr(tmp, '\n', ' ');282 owl_fmtext_append_ztext(fm, tmp);283 owl_fmtext_append_normal(fm, "\n");284 if (tmp) owl_free(tmp);285 }286 287 /* make personal messages bold for smaat users */288 if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES) &&289 owl_message_is_personal(m) &&290 owl_message_is_direction_in(m)) {291 owl_fmtext_addattr(fm, OWL_FMTEXT_ATTR_BOLD);292 }293 294 owl_free(sender);295 owl_free(recip);296 #endif297 } else if (owl_message_is_type_aim(m)) {298 owl_fmtext_append_spaces(fm, OWL_TAB);299 if (owl_message_is_login(m)) {300 tmp=owl_sprintf(baseformat, "<", "AIM LOGIN", "", owl_message_get_sender(m));301 owl_fmtext_append_normal(fm, tmp);302 owl_fmtext_append_normal(fm, "\n");303 if (tmp) owl_free(tmp);304 } else if (owl_message_is_logout(m)) {305 tmp=owl_sprintf(baseformat, "<", "AIM LOGOUT", "", owl_message_get_sender(m));306 owl_fmtext_append_normal(fm, tmp);307 owl_fmtext_append_normal(fm, "\n");308 if (tmp) owl_free(tmp);309 } else {310 if (owl_message_is_direction_in(m)) {311 tmp=owl_sprintf(baseformat, "<", "AIM", "", owl_message_get_sender(m));312 owl_fmtext_append_normal(fm, tmp);313 if (tmp) owl_free(tmp);314 } else if (owl_message_is_direction_out(m)) {315 tmp=owl_sprintf(baseformat, ">", "AIM", "", owl_message_get_recipient(m));316 owl_fmtext_append_normal(fm, tmp);317 if (tmp) owl_free(tmp);318 }319 320 tmp=owl_strdup(owl_message_get_body(m));321 owl_text_tr(tmp, '\n', ' ');322 owl_fmtext_append_normal(fm, tmp);323 owl_fmtext_append_normal(fm, "\n");324 if (tmp) owl_free(tmp);325 326 /* make personal messages bold for smaat users */327 if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES) && owl_message_is_direction_in(m)) {328 owl_fmtext_addattr(fm, OWL_FMTEXT_ATTR_BOLD);329 }330 }331 } else if (owl_message_is_type_admin(m)) {332 owl_fmtext_append_spaces(fm, OWL_TAB);333 owl_fmtext_append_normal(fm, "< ADMIN ");334 335 tmp=owl_strdup(owl_message_get_body(m));336 owl_text_tr(tmp, '\n', ' ');337 owl_fmtext_append_normal(fm, tmp);338 owl_fmtext_append_normal(fm, "\n");339 if (tmp) owl_free(tmp);340 } else {341 owl_fmtext_append_spaces(fm, OWL_TAB);342 owl_fmtext_append_normal(fm, "< LOOPBACK ");343 344 tmp=owl_strdup(owl_message_get_body(m));345 owl_text_tr(tmp, '\n', ' ');346 owl_fmtext_append_normal(fm, tmp);347 owl_fmtext_append_normal(fm, "\n");348 if (tmp) owl_free(tmp);349 }350 351 }
Note: See TracChangeset
for help on using the changeset viewer.