[7d4fbcd] | 1 | ### The owlconf config file -*- perl -*- |
---|
| 2 | ### $Id$ |
---|
[f1e629d] | 3 | ### |
---|
[b950088] | 4 | ### !!!!!WARNING!!!!! !!!!!WARNING!!!!! !!!!!WARNING!!!!! !!!!!WARNING!!!!! |
---|
| 5 | ### This is an example file intended to demonstrate how to use |
---|
| 6 | ### various features of owl. Some of the key bindings, in particular, |
---|
| 7 | ### are more for examples than things you may actually want to use. |
---|
| 8 | ### Make sure to read through it first and understand it before just using it. |
---|
| 9 | ### Don't blame me if anything in here ends up vaporizing your dog. |
---|
| 10 | ### !!!!!WARNING!!!!! !!!!!WARNING!!!!! !!!!!WARNING!!!!! !!!!!WARNING!!!!! |
---|
[f1e629d] | 11 | ### |
---|
[7d4fbcd] | 12 | ### |
---|
| 13 | ### This file is interpreted by the perl interpreter. |
---|
| 14 | ### If you wish to execute an owl command use the |
---|
| 15 | ### function owl::command(). i.e. |
---|
| 16 | ### |
---|
| 17 | ### owl::command("set zsigproc /mit/kretch/bin/getzsig"); |
---|
| 18 | ### |
---|
| 19 | ### will set the owl variable zsigproc. Subroutines created with |
---|
| 20 | ### the names below will be executed at the specified times: |
---|
| 21 | ### |
---|
| 22 | ### subroutine name properties |
---|
| 23 | ### --------------- ---------- |
---|
| 24 | ### owl::startup() run when owl first starts |
---|
| 25 | ### owl::shutdown() run when owl exits |
---|
[f1e629d] | 26 | ### owl::format_msg() formats messages that are passed to it |
---|
[7d4fbcd] | 27 | ### owl::receive_msg() run when a message is received, and after |
---|
| 28 | ### it has been added to the message list |
---|
| 29 | ### |
---|
[f1e629d] | 30 | ### The format_msg and receive_msg functions are passed owl::Message objects. |
---|
| 31 | ### The message attributes may be dereferenced with $m->attribute |
---|
[7d4fbcd] | 32 | ### |
---|
| 33 | ### |
---|
| 34 | |
---|
| 35 | # tokens for sepbar are: |
---|
| 36 | # .username = ping |
---|
| 37 | # >username = login |
---|
| 38 | # <username = logout |
---|
| 39 | # :username = personal message |
---|
| 40 | # M = mail received |
---|
| 41 | my @sepbartokens = (); |
---|
| 42 | |
---|
[f1e629d] | 43 | # Map for mail messages from msg id to pop msg id |
---|
| 44 | my %mail_id_map = (); |
---|
| 45 | |
---|
| 46 | # (originally from jdaniel) |
---|
| 47 | sub mail_add_message ($) { |
---|
| 48 | my ($m) = @_; |
---|
| 49 | my $from = `from -t`; |
---|
| 50 | # example value: |
---|
| 51 | # You have 188 messages (667593 bytes) on PO11.MIT.EDU. |
---|
| 52 | my ($msg_num) = $from =~ m/(\d+)/; |
---|
| 53 | $mail_id_map{$m->id} = $msg_num; |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | |
---|
| 57 | sub mail_pop_curmsg () { |
---|
| 58 | my $m = owl::getcurmsg(); |
---|
| 59 | if (!$m->is_mail || !defined $mail_id_map{$m->id}) { |
---|
| 60 | &owl::command("pop-message"); |
---|
| 61 | } else { |
---|
| 62 | &owl::command(sprintf 'pexec pop -request c -request "retr %d" -request q', |
---|
| 63 | $mail_id_map{$m->id}); |
---|
| 64 | } |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | sub zlocatesender { |
---|
| 68 | my $m = owl::getcurmsg(); |
---|
| 69 | if ($m->{"type"} eq "zephyr") { |
---|
| 70 | my $sender = $m->{"sender"}; |
---|
| 71 | owl::command("zlocate $sender"); |
---|
| 72 | } |
---|
| 73 | } |
---|
[7d4fbcd] | 74 | |
---|
| 75 | # adds a sepbartoken and also updates the appendtosepbar variable |
---|
| 76 | sub sepbartokens_add { |
---|
| 77 | my ($token) = @_; |
---|
| 78 | $token =~ s/"//g; # " |
---|
| 79 | unshift @sepbartokens, $token; |
---|
| 80 | pop @sepbartokens if (@sepbartokens > 80); |
---|
| 81 | sepbartokens_set(); |
---|
| 82 | } |
---|
| 83 | |
---|
| 84 | # trims a sepbartoken from the list also updates the appendtosepbar variable |
---|
| 85 | sub sepbartokens_trim { |
---|
| 86 | my ($token) = @_; |
---|
| 87 | @sepbartokens = map { if ($_ ne $token) { $_; } else { (); } } @sepbartokens; |
---|
| 88 | sepbartokens_set(); |
---|
| 89 | } |
---|
| 90 | |
---|
[f1e629d] | 91 | my $loopctr=0; |
---|
| 92 | |
---|
[7d4fbcd] | 93 | # trims a sepbartoken from the list also updates the appendtosepbar variable |
---|
| 94 | sub sepbartokens_set { |
---|
[f1e629d] | 95 | owl::command(sprintf "set -q appendtosepbar \"%s %s %s\"", (scalar localtime), (join " ", @sepbartokens)); |
---|
[7d4fbcd] | 96 | } |
---|
| 97 | |
---|
[8ee73f8d] | 98 | my $restoreview = undef; |
---|
| 99 | sub swapview { |
---|
| 100 | my $curview = owl::command("getview"); |
---|
| 101 | if ($restoreview) { |
---|
| 102 | owl::command("view $restoreview"); |
---|
[f1e629d] | 103 | $restoreview = undef; |
---|
[8ee73f8d] | 104 | } else { |
---|
[f1e629d] | 105 | $restoreview = $curview; |
---|
| 106 | owl::command("smartnarrow"); |
---|
[8ee73f8d] | 107 | } |
---|
| 108 | } |
---|
| 109 | |
---|
| 110 | my $lastcolored = undef; |
---|
| 111 | sub colorthread { |
---|
| 112 | if ($lastcolored) { |
---|
| 113 | owl::command("filter $lastcolored -c default"); |
---|
| 114 | } |
---|
| 115 | my $smartfilt = owl::command("smartfilter"); |
---|
| 116 | if (!$smartfilt or $smartfilt eq $lastcolored) { |
---|
| 117 | owl::command("filter $lastcolored -c default"); |
---|
| 118 | $lastcolored = undef; |
---|
| 119 | } else { |
---|
| 120 | owl::command("filter $smartfilt -c green"); |
---|
[f1e629d] | 121 | $lastcolored = $smartfilt; |
---|
| 122 | } |
---|
| 123 | } |
---|
| 124 | |
---|
| 125 | # Load in things which don't belong in an owlconf |
---|
| 126 | # that people might use as an example... |
---|
| 127 | sub personal_startup { |
---|
| 128 | my $personalconf = $ENV{"HOME"}."/.owl/personalconf"; |
---|
| 129 | if (-f $personalconf) { |
---|
| 130 | my $b = ""; |
---|
| 131 | open INB, $personalconf; |
---|
| 132 | for (<INB>) { $b .= $_; } |
---|
| 133 | close INB; |
---|
| 134 | eval $b; |
---|
[8ee73f8d] | 135 | } |
---|
| 136 | } |
---|
| 137 | |
---|
[7d4fbcd] | 138 | sub owl::startup { |
---|
[f1e629d] | 139 | owl::command("set -q logging on"); |
---|
| 140 | owl::command("set -q logpath ~/.zlog/owl/personal"); |
---|
| 141 | owl::command("set -q classlogpath ~/.zlog/owl/class"); |
---|
| 142 | owl::command("set -q logging on"); |
---|
[7d4fbcd] | 143 | owl::command("set -q startuplogin off"); |
---|
| 144 | owl::command("set -q shutdownlogout off"); |
---|
| 145 | #owl::command("set personalbell on"); |
---|
[f1e629d] | 146 | owl::command("set -q _burningears on"); |
---|
[7d4fbcd] | 147 | owl::command("set -q rxping on"); |
---|
| 148 | owl::command("set -q typewinsize 5"); |
---|
[f1e629d] | 149 | if ($ENV{"DISPLAY"} eq ":0.0") { |
---|
[7d4fbcd] | 150 | owl::command("set -q webbrowser galeon"); |
---|
| 151 | } |
---|
[f1e629d] | 152 | owl::command("filter me recipient %me% or ( sender %me% and class message and instance personal ) or class mail or type aim"); |
---|
| 153 | owl::command("filter owl instance ^owl.*"); |
---|
[7d4fbcd] | 154 | |
---|
[f1e629d] | 155 | owl::command(q(alias finger pperl $x=owl::getcurmsg()->hostname; `finger \@$x`;)); |
---|
| 156 | owl::command("bindkey recv f command finger"); |
---|
[b950088] | 157 | |
---|
[f1e629d] | 158 | owl::command("alias z zwrite"); |
---|
| 159 | owl::command("alias zw zwrite"); |
---|
| 160 | owl::command("alias v view"); |
---|
[b950088] | 161 | |
---|
[f1e629d] | 162 | owl::command("alias popmail perl mail_pop_curmsg();"); |
---|
[b950088] | 163 | |
---|
[f1e629d] | 164 | # toggle between a view and a smartnarrow with TAB |
---|
[8ee73f8d] | 165 | owl::command("alias swapview perl swapview();"); |
---|
| 166 | owl::command("bindkey recv C-i command swapview"); |
---|
| 167 | |
---|
| 168 | # color the current thread |
---|
| 169 | owl::command("alias colorthread perl colorthread();"); |
---|
| 170 | owl::command("bindkey recv M-c command colorthread"); |
---|
| 171 | |
---|
[f1e629d] | 172 | # zlocate current sender |
---|
| 173 | owl::command("bindkey recv L command perl zlocatesender();"); |
---|
| 174 | |
---|
| 175 | # Declare styles |
---|
| 176 | &owl::command("style vt perl format_msg_vt"); |
---|
| 177 | &owl::command("style brief perl format_msg_brief"); |
---|
| 178 | &owl::command("style custom perl format_msg_custom"); |
---|
| 179 | &owl::command("style debug perl format_msg_debug"); |
---|
| 180 | &owl::command("set -q default_style custom"); |
---|
| 181 | |
---|
| 182 | # Change to different view styles |
---|
| 183 | owl::command("bindkey recv \"C-s v\" command view -s vt"); |
---|
| 184 | owl::command("bindkey recv \"C-s c\" command view -s custom"); |
---|
| 185 | owl::command("bindkey recv \"C-s b\" command view -s brief"); |
---|
| 186 | owl::command("bindkey recv \"C-s d\" command view -s debug"); |
---|
| 187 | owl::command("bindkey recv \"C-s o\" command view -s standard"); |
---|
[7d4fbcd] | 188 | |
---|
[f1e629d] | 189 | # For fast-reading of zephyrs |
---|
| 190 | owl::command("bindkey recv M-k command ( smartnarrow ; delete view )"); |
---|
| 191 | owl::command("bindkey recv M-l command ( expunge ; view all )"); |
---|
| 192 | owl::command("bindkey recv M-K command ( smartnarrow ; delete view ; expunge ; view all )"); |
---|
| 193 | |
---|
| 194 | # Support for scroll mice |
---|
| 195 | &owl::command("bindkey recv \"M-[ A\" command recv:prev"); |
---|
| 196 | &owl::command("bindkey recv \"M-[ B\" command recv:next"); |
---|
| 197 | |
---|
| 198 | # This overrides the default "M" keybinding |
---|
| 199 | owl::command("bindkey recv M command popmail"); |
---|
| 200 | |
---|
| 201 | sepbartokens_add("..."); |
---|
| 202 | |
---|
| 203 | personal_startup(); |
---|
[7d4fbcd] | 204 | } |
---|
| 205 | |
---|
| 206 | sub owl::shutdown { |
---|
| 207 | # not doing anything at the moment... |
---|
| 208 | } |
---|
| 209 | |
---|
[f1e629d] | 210 | |
---|
| 211 | # run when a message is received, and after |
---|
| 212 | # it has been added to the message list. |
---|
| 213 | sub owl::receive_msg { |
---|
| 214 | my ($m) = @_; |
---|
| 215 | my ($out, $tmp); |
---|
| 216 | |
---|
| 217 | if ($m->is_admin && !$m->is_outgoing) { |
---|
| 218 | $m->delete(); |
---|
| 219 | return 1; |
---|
| 220 | } |
---|
| 221 | |
---|
| 222 | return 0 if (!$m->is_zephyr && !$m->is_aim); |
---|
| 223 | |
---|
| 224 | my $sender = $m->pretty_sender; |
---|
| 225 | |
---|
| 226 | if ($m->is_ping) { |
---|
| 227 | sepbartokens_add(".$sender"); |
---|
| 228 | $m->delete(); |
---|
| 229 | } elsif ($m->is_loginout) { |
---|
| 230 | $m->delete(); |
---|
| 231 | if ($m->is_login) { |
---|
| 232 | sepbartokens_add(">$sender"); |
---|
| 233 | sepbartokens_trim("<$sender"); |
---|
| 234 | } elsif ($m->is_logout) { |
---|
| 235 | sepbartokens_add("<$sender"); |
---|
| 236 | sepbartokens_trim(">$sender"); |
---|
| 237 | } |
---|
| 238 | } elsif ($m->is_mail) { |
---|
| 239 | mail_add_message($m); |
---|
| 240 | $m->delete(); |
---|
| 241 | sepbartokens_add("M"); |
---|
| 242 | } |
---|
| 243 | |
---|
| 244 | if ($m->is_personal) { |
---|
| 245 | sepbartokens_trim(".$sender"); |
---|
| 246 | sepbartokens_add(":$sender"); |
---|
| 247 | } |
---|
| 248 | |
---|
| 249 | return 1; |
---|
| 250 | } |
---|
| 251 | |
---|
| 252 | sub indent4 { |
---|
| 253 | my ($b) = @_; |
---|
| 254 | $b=~s/^/ /g; |
---|
| 255 | $b=~s/\n/\n /g; |
---|
| 256 | return $b; |
---|
| 257 | } |
---|
| 258 | |
---|
[7d4fbcd] | 259 | # run to format a message |
---|
[f1e629d] | 260 | sub format_msg_custom { |
---|
| 261 | my ($m) = @_; |
---|
| 262 | my ($out, $tmp); |
---|
| 263 | |
---|
| 264 | if ($m->is_admin) { |
---|
| 265 | $out = "\@bold([owl admin]) ".$m->header."\n"; |
---|
| 266 | $out.=indent4($m->body); |
---|
| 267 | return $out."\n"; |
---|
| 268 | } |
---|
| 269 | |
---|
| 270 | my $sender=$m->pretty_sender; |
---|
[7d4fbcd] | 271 | |
---|
[f1e629d] | 272 | if (($m->is_aim or $m->is_zephyr) && $m->is_loginout) { |
---|
[7d4fbcd] | 273 | |
---|
[f1e629d] | 274 | if ($m->is_login) { |
---|
[7d4fbcd] | 275 | $out="\@bold(LOGIN)"; |
---|
[f1e629d] | 276 | } elsif ($m->is_logout) { |
---|
[7d4fbcd] | 277 | $out="\@bold(LOGOUT)"; |
---|
| 278 | } else { |
---|
| 279 | $out="\@bold(UNKNOWN)"; |
---|
| 280 | } |
---|
[f1e629d] | 281 | $out.=" for \@bold($sender) on ".$m->type; |
---|
| 282 | if ($m->is_zephyr) { |
---|
[5d9c664] | 283 | $out.=" at ".($m->login_host)." on ".($m->login_tty); |
---|
[f1e629d] | 284 | } |
---|
[5d9c664] | 285 | return("$out\n"); |
---|
[f1e629d] | 286 | } |
---|
| 287 | |
---|
| 288 | if (!$m->is_zephyr && !$m->is_aim) { |
---|
| 289 | return "Unknown message type: ".$m->type."\n"; |
---|
| 290 | } |
---|
| 291 | |
---|
| 292 | if ($m->is_outgoing) { |
---|
| 293 | my $target = $m->recipient; |
---|
| 294 | if ($m->is_zephyr) { |
---|
| 295 | $target = $m->zwriteline; |
---|
| 296 | $target =~ s/^zwrite //; |
---|
| 297 | } |
---|
| 298 | $out = sprintf "\@bold([outgoing %s to %s]) / %s\n", $m->type, $target, $m->time; |
---|
| 299 | $out.=indent4($m->body); |
---|
[5d9c664] | 300 | return "$out\n"; |
---|
[f1e629d] | 301 | } |
---|
| 302 | |
---|
| 303 | if ($m->is_zephyr && $m->is_ping) { |
---|
| 304 | return("\@bold(PING) from \@bold($sender)\n"); |
---|
| 305 | } elsif ($m->is_zephyr && $m->is_mail) { |
---|
[7d4fbcd] | 306 | $out = "\@bold(MAIL) "; |
---|
[f1e629d] | 307 | if ($m->body =~ /^From:\s+(.+)\s*$/m) { $out .= "From $1 "; } |
---|
| 308 | if ($m->body =~ /^To:\s+(.+)\s*$/m) { $out .= "To $1 "; } |
---|
| 309 | if ($m->body =~ /^Subject:\s+(.+)\s*$/m) { $out .= "Subject $1 "; } |
---|
[5d9c664] | 310 | return("$out\n"); |
---|
[7d4fbcd] | 311 | } |
---|
| 312 | |
---|
[f1e629d] | 313 | if ($m->is_zephyr) { |
---|
| 314 | $out = sprintf "[mit,%s,%s] / %s / %s", lc($m->class), |
---|
| 315 | lc($m->instance), $m->time, lc($m->host); |
---|
| 316 | if ($m->opcode ne "") {$out.=" op:".$m->opcode;} |
---|
| 317 | $out.="\n"; |
---|
| 318 | $out.= " \@bold($sender)> "; |
---|
| 319 | if ($m->zsig ne "") { |
---|
| 320 | my $zsig = $m->zsig; |
---|
| 321 | $zsig =~ s/(\n.*)+$/ [...]/; |
---|
| 322 | if (length($zsig)+5+length($sender) > 70) { |
---|
| 323 | $out.="# ..."; |
---|
| 324 | } else { |
---|
| 325 | $out.="# $zsig"; |
---|
| 326 | } |
---|
[7d4fbcd] | 327 | } |
---|
[f1e629d] | 328 | $out.="\n"; |
---|
| 329 | } else { |
---|
| 330 | $out = sprintf "[%s] / %s\n", lc($m->type), $m->time; |
---|
| 331 | $out.= " \@bold($sender)> "; |
---|
| 332 | $out.="\n"; |
---|
[7d4fbcd] | 333 | } |
---|
| 334 | |
---|
[f1e629d] | 335 | $out.=indent4($m->body); |
---|
[7d4fbcd] | 336 | |
---|
| 337 | # make personal messages bold |
---|
[f1e629d] | 338 | if ($m->is_personal) { |
---|
[7d4fbcd] | 339 | $out="\@bold{".$out."}"; |
---|
| 340 | } |
---|
| 341 | |
---|
| 342 | return($out."\n"); |
---|
| 343 | } |
---|
| 344 | |
---|
[f1e629d] | 345 | sub format_msg_debug { |
---|
| 346 | my ($m) = @_; |
---|
| 347 | return "\@bold(-------------MESSAGE-------------)\n".($m->serialize).".\n"; |
---|
| 348 | } |
---|
| 349 | |
---|
| 350 | sub format_msg_brief { |
---|
| 351 | my ($m) = @_; |
---|
| 352 | my $out = format_msg_vt($m); |
---|
| 353 | $out =~ s/\n/ /g; |
---|
| 354 | $out =~ s/ / /g; |
---|
| 355 | return($out."\n"); |
---|
| 356 | } |
---|
| 357 | |
---|
| 358 | |
---|
| 359 | sub format_msg_vt { |
---|
| 360 | my ($m) = @_; |
---|
| 361 | my ($out, $tmp); |
---|
| 362 | |
---|
| 363 | if ($m->is_admin) { |
---|
| 364 | $out = sprintf "%-29s \@i(%s)", "\@bold(OWL ADMIN)", $m->header; |
---|
| 365 | $tmp=$m->body; |
---|
| 366 | $tmp=~s/^/ /g; |
---|
| 367 | $tmp=~s/\n/\n /g; |
---|
| 368 | $out.="\n".$tmp; |
---|
| 369 | return $out; |
---|
[7d4fbcd] | 370 | } |
---|
| 371 | |
---|
[f1e629d] | 372 | my $sender=$m->pretty_sender; |
---|
| 373 | |
---|
| 374 | if ($m->is_outgoing) { |
---|
| 375 | my $target = $m->recipient; |
---|
| 376 | if ($m->is_zephyr) { |
---|
| 377 | $target = $m->zwriteline; |
---|
| 378 | $target =~ s/^zwrite //; |
---|
| 379 | } |
---|
| 380 | $out = sprintf "%-15s %-13s", "\@bold(OUTGOING)", "to $target via ".$m->type.": "; |
---|
| 381 | my $pagewidth = owl::getnumcols()-6; |
---|
| 382 | $out .= fill_text($m->body, $pagewidth, 22, 1); |
---|
| 383 | return $out; |
---|
| 384 | } |
---|
| 385 | |
---|
| 386 | if (!$m->is_zephyr && !$m->is_aim) { |
---|
| 387 | return "Unknown message type: ".$m->type."\n"; |
---|
| 388 | } |
---|
| 389 | |
---|
| 390 | if ($m->is_zephyr && $m->is_ping) { |
---|
| 391 | return (sprintf "%-15s %-13s\n", "\@bold(PING)", $sender); |
---|
| 392 | } elsif ($m->is_loginout) { |
---|
| 393 | my $state; |
---|
| 394 | if ($m->is_login) { |
---|
| 395 | $state="\@bold(LOGIN)"; |
---|
| 396 | } elsif ($m->is_logout) { |
---|
| 397 | $state="\@bold(LOGOUT)"; |
---|
| 398 | } else { |
---|
| 399 | $state="\@bold(UNKNOWN)"; |
---|
| 400 | } |
---|
| 401 | my $out = sprintf "%-15s %-13s ", $state, $sender; |
---|
| 402 | if ($m->is_zephyr) { |
---|
| 403 | $out .= sprintf "via %s on %s at %s", $m->type, $m->login_host, $m->login_tty; |
---|
| 404 | } else { |
---|
| 405 | $out .= sprintf "via %s", $m->type; |
---|
| 406 | } |
---|
| 407 | return "$out\n"; |
---|
| 408 | |
---|
| 409 | } elsif ($m->is_zephyr && $m->is_mail) { |
---|
| 410 | my $body = $m->body; |
---|
| 411 | $out = sprintf "%-15s %-13s ", "\@bold(MAIL)", ""; |
---|
| 412 | if ($body =~ /^From:\s+(.+)\s*$/m) { $out .= "From $1 "; } |
---|
| 413 | if ($body =~ /^To:\s+(.+)\s*$/m) { $out .= "To $1 "; } |
---|
| 414 | if ($body =~ /^Subject:\s+(.+)\s*$/m) { $out .= "Subject $1 "; } |
---|
| 415 | return($out."\n"); |
---|
| 416 | } |
---|
| 417 | |
---|
| 418 | my $channel = ""; |
---|
| 419 | my $body = $m->body; |
---|
| 420 | |
---|
| 421 | if ($m->is_zephyr) { |
---|
| 422 | my $inst = $m->instance; |
---|
| 423 | $channel = $m->class; |
---|
| 424 | if (lc($m->class) ne "message" and lc($m->instance) eq "personal") { |
---|
| 425 | $inst = ""; |
---|
| 426 | } |
---|
| 427 | $channel .= "[".$inst."]"; |
---|
| 428 | $channel = substr($channel,0,13); |
---|
| 429 | } else { |
---|
| 430 | $channel = "[".$m->type."]"; |
---|
| 431 | } |
---|
| 432 | |
---|
| 433 | $header = sprintf "%-8s %-13s ", lc($sender), lc($channel); |
---|
| 434 | |
---|
| 435 | if ($body =~ /=/) { |
---|
| 436 | # indent it |
---|
| 437 | $out.=$header."\n".indent4($body); |
---|
| 438 | } else { |
---|
| 439 | # fill it |
---|
| 440 | my $pagewidth = owl::getnumcols()-6; |
---|
| 441 | $out .= $header; |
---|
| 442 | $out .= fill_text($body, $pagewidth, 22, 1); |
---|
| 443 | } |
---|
| 444 | |
---|
| 445 | # note: no zsig added in this version |
---|
[7d4fbcd] | 446 | |
---|
| 447 | # make personal messages bold |
---|
[f1e629d] | 448 | if ($m->is_personal) { |
---|
| 449 | $out="\@bold{".$out."}"; |
---|
[7d4fbcd] | 450 | } |
---|
[f1e629d] | 451 | return($out); |
---|
| 452 | } |
---|
[7d4fbcd] | 453 | |
---|
[f1e629d] | 454 | sub fill_text { |
---|
| 455 | my ($in, $width, $indent, $unindent_first) = @_; |
---|
| 456 | $indent = 0 if (@_ < 3); |
---|
| 457 | my $unindent = $indent if ($unindent_first); |
---|
| 458 | my @words = split " ", $in; |
---|
| 459 | my $out = ""; |
---|
| 460 | my $outline = ""; |
---|
| 461 | if (!$unindent_first) { |
---|
| 462 | my $outline = " "x$indent; |
---|
| 463 | } |
---|
| 464 | for my $w (@words) { |
---|
| 465 | if (($outline ne "") |
---|
| 466 | && (length($outline)+length($w) > $width-$unindent)) { |
---|
| 467 | $out .= $outline."\n"; |
---|
| 468 | $outline = " "x$indent; |
---|
| 469 | $unindent = 0; |
---|
| 470 | } |
---|
| 471 | if ($outline =~ /.*\.$/) { |
---|
| 472 | $outline .= " "; |
---|
| 473 | } elsif ($outline ne "") { |
---|
| 474 | $outline .= " "; |
---|
| 475 | } |
---|
| 476 | $outline .= $w; |
---|
| 477 | } |
---|
| 478 | $out .= $outline . "\n"; |
---|
[7d4fbcd] | 479 | } |
---|