source: examples/owlconf.simple @ fa00c5c

owl
Last change on this file since fa00c5c was dab82f29, checked in by James M. Kretchmar <kretch@mit.edu>, 15 years ago
Don't crash on mobile device AIM messages [BZ 20] Don't crash when sending to someone not on AIM buddy list [BZ 94] Fix overflow vulerability in zwrite.c and zcrypt.c Add stack protector and -D_FORTIFY_SOURCE=2 where possible Fix hang [barnowl 4c46dfdebc294ca24fef59924f01688b8ee07dee] Fix segfault on missing subs [barnowl 99dabeed7de6d19acb50f1e73aa0bfe5f9469c02] Fix zcrypt bufffer size bug [barnowl 559076cd86edc3a8317819814dd5877b8bc7c3cb] Fix double free [barnowl e97c4a306ae2c9d2147d83da29fee59918198e70] Memory leak fix [barnowl c0a90c2c7ab97b9465c9873757faf312faa0021e] Memory leak fix [barnowl 95caa16b2e9ba10770d87d0955198c14c2d0e16a] Memory leak fix [barnowl 1716fed8c2650e46892cf6571555eac937266c6e] Add getstyle command [barnowl 216c73421653e3ef0e957aa9a9804e208a77c80e] Binary search for msgid [barnowl 0c8ab5eadbb6ecc97a120c91b9a824b33538c764] File-handle leak [barnowl e78397d6ac5da0de31a4e269c0ba7f3d691857a3] Fix delay in jump from top to bottom [barnowl 801b7ac63b962640debbcfd422cb9a60da5fea31] Load subs in chunks [barnowl 93e883d60051b80bf6d35391f9d76fd7dfd198e3] Load subs in chunks [barnowl f6050ee9b0a171a5031f84409eb181062afacd18] Better zsig logging [barnowl d857b667a5a9b108b1a2a26b4a5513bef2b53f80] free() -> owlfree() [barnowl d524c838ac7c115628424b8ac171c3489622ea3a] Escape AIM users in smartfilters [barnowl af9b92e3e7ccb7de276a94b5c7e5861b24e71eff] Better regex escape chars [barnowl 80e54a7631f091be8c9762adb9746bad38104738] Deal with quotes in smart filters [barnowl 4099cf83702763fa8d1efc4f1582a605431bdb77] Deal with 0 length zephyr fields [barnowl 128171aaf7cefa91a4bb1eada93a19d8fd0c355c] Deal with 0 length zephyr fields [barnowl 50e29e35c64d64e223d378d350a7bc4f038d78f5] Deal with 0 length zephyr fields [barnowl 804ab8af8b6d00bcd7e2402df892db8fbd61a3ec] Leave curmsg on screen after resize [barnowl c0f9e3009bc03e80a44de64cd5f2b4033290236e] Rip out brower stuff [barnowl 8e5935d11c699a7ce5a3e6e9a47799564c696d6a] Rip out browser stuff [barnowl 4f15e8e9ceada0d4b2cc969ebf43b0a1fb3709ea] No passwords in command history [barnowl 6e400cc71aa59e041dce677aadf50dc1f25228e2] Format NOC mssages [barnowl a1bb1980e4bca23b8329cc0e7c0bd5027055ea0a] Expand ~ in loadsubs [barnowl 27d8d835dc6d58c08fae10e75aae306c49215143] Expand ~ in source [barnowl 10d67d57cb29221f63a43a30643c697fc7b38911] Only use resizeterm() if it's available Debian backports Change license to GPLv3
  • Property mode set to 100644
File size: 9.7 KB
Line 
1### The owlconf config file   -*- perl -*- 
2###  $Id$
3
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!!!!!
11
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
26###     owl::format_msg()  run when a new message arrives, the return
27###                           value is used to display the message on the
28###                           screen
29###     owl::receive_msg() run when a message is received, and after
30###                        it has been added to the message list
31###
32###
33### The following variables will be set each time a message is recevied
34### and when owl::format_msg() and owl::receive_msg() are run.
35###
36###     $owl::class, $owl::instance, $owl::recipient, $owl::direction,
37###     $owl::sender, $owl::opcode, $owl::zsig,
38###     $owl::msg, $owl::time, $owl::host, @owl::fields, $owl::id
39###   
40
41# NOTE: Lines beginning with a "#" are perl comments.
42
43
44# This subroutine is run whenever owl starts up.
45# The owl::command("foo") lines execute the owl command "foo".
46sub owl::startup {
47
48    ################################################################
49    ## The following set the values of variables.
50    ## Doing "help" will show you more about each variable.
51    ## These lines will set things to the default.
52    ## You can uncomment them and then change the value to get
53    ## a different behavior (remove the "#" to an alternate value).
54    ################################################################
55
56    ## Set this to off to disable the terminal bell.
57    # owl::command('set -q bell on');
58
59    ## Set this to off to disable the terminal bell on personal zephyrs.
60    # owl::command('set -q personalbell off');
61
62    ## Set this to on to enable logging of personal zephyrs
63    # owl::command('set -q logging off'); 
64
65    ## This directory must exist and is where personal zephyrs are logged.
66    ## By default, this is the ~/zlog/personal/ directory
67    # owl::command('set -q logpath '.$ENV{'HOME'}.'/zlog/personal/');
68
69    ## Set this to on to enable logging of classes
70    # owl::command('set -q classlogging off'); 
71
72    ## This directory must exist and is where class zephyrs are logged.
73    ## By default, this is the ~/zlog/class/ directory
74    # owl::command('set -q classlogpath '.$ENV{'HOME'}.'/zlog/class/');
75
76    ## If set to on, this will make is so that C-d doesn't
77    ## send zephyrs by accident.
78    # owl::command('set -q disable-ctrl-d off');
79
80    ## If set to on, outgoing messages will be displayed.
81    # owl::command('set -q displayoutgoing on');
82
83    ## Displays received pings?
84    # owl::command('set -q rxping off');
85
86    ## Send pings?
87    # owl::command('set -q txping on');
88
89    ## Size of typing window at the bottom of the screen
90    # owl::command('set -q typewinsize 8');
91
92    ## Which view to switch to after the 'V' or 'X' commands.
93    # owl::command('set -q view_home all');
94
95
96    ## Default message to send when zaway is on (toggle with 'A')
97    # owl::command('set -q zaway_msg_default "Not here now..."');
98
99    ## Default zephyr signature.
100    # owl::command('set -q zsig "meep"');
101
102    ## Program to generate a zsig.
103    # owl::command('set -q zsigproc "/mit/foo/bin/randzsig"');
104
105
106    ################################################################
107    ## The following create filters.  Filters can be used to select
108    ## on multiple zephyrs for operations.  With 'views' you can
109    ## look at only the zephyrs matching a particular filter.
110    ## Use the 'view <filtername>' command or the 'v' key to switch views.
111    ## The 'V' key will switch you back to your 'view_home' view.
112    ## The M-D key will delete all messages in the current view
113    ##
114    ##
115    ## The filter command creates a filter with the specified name,
116    ## or if one already exists it is replaced.  Example filter
117    ## syntax would be:                                       
118    ##
119    ##    filter myfilter -c red ( class ^foobar$ ) or ( class ^quux$ and instance ^bar$ )
120    ##
121    ## Valid matching fields are class, instance, recipient, sender, opcode
122    ## and realm.  Valid operations are 'and', 'or' and 'not'.  Spaces must be
123    ## present before and after parenthesis.  If the optional color argument
124    ## is used it specifies the color that messages matching this filter
125    ## should be displayed in.  Do 'show colors' to see the available colors.
126    ##
127    ################################################################
128
129    ## This would create a shortcut to only show personal messages
130    ## with filter 'me' and to color them yellow.
131    ## Replace myusername with yours.
132    # owl::command('filter me -c yellow recipient myusername');
133
134    ## This would create a 'quiet' filter to not show messages
135    ## on noisy classes and instances.
136    # owl::command('filter quiet not ( class ^foo|bar|quux$ or instance ( ^baaz$ ) ');
137
138    ## The 'trash' filter is used when you press 'T' to mark things
139    ## for autodeletion.
140    # owl::command('filter trash class ^mail$ or opcode ^ping$ or type ^admin$ or class ^login$');   
141
142}
143
144## This is run when owl exits.  Currently this does nothing.
145sub owl::shutdown {
146}
147
148## This is run to format the contents of the message.
149## It returns a string which is a formatted message.
150## The following variables will be set each time before this is run:
151##
152##     $owl::class, $owl::instance, $owl::recipient,
153##     $owl::sender, $owl::opcode, $owl::zsig,
154##     $owl::msg, $owl::time, $owl::host, @owl::fields, $owl::id
155
156sub owl::format_msg {
157    my $out, $tmp;
158
159    ## Strip out noise from the sender string.
160    $owl::sender=~s/\@ATHENA\.MIT\.EDU$//;
161    $owl::sender=~s/\@local-realm$//;
162    $owl::recipient=~s/\@ATHENA\.MIT\.EDU$//;
163    $owl::recipient=~s/\@local-realm$//;
164
165    ## Format ping, login, and mail messages.
166    ## uc(foo) upcases the string and "eq" does string comparison.
167    if (uc($owl::opcode) eq "PING") {
168        return("\@bold(PING) from \@bold($owl::sender)\n");
169    } elsif (uc($owl::class) eq "LOGIN") {
170        if (uc($owl::opcode) eq "USER_LOGIN") {
171            $out="\@bold(LOGIN)";
172        } elsif (uc($owl::opcode) eq "USER_LOGOUT") {
173            $out="\@bold(LOGOUT)";
174        } else {
175            $out="\@bold(UNKNOWN)";
176        }
177        $out.=" for \@bold($owl::sender) at $fields[0] on $fields[2]\n";
178        return($out);
179    } elsif (uc($owl::class) eq "MAIL" and uc($owl::instance) eq "INBOX") {
180        $out = "\@bold(MAIL) ";
181        if ($owl::msg =~ /^From:\s+(.+)\s*$/m) { $out .= "From $1 "; }
182        if ($owl::msg =~ /^To:\s+(.+)\s*$/m) { $out .= "To $1 "; }
183        if ($owl::msg =~ /^Subject:\s+(.+)\s*$/m) { $out .= "Subject $1 "; }
184        return($out."\n");
185    }
186
187    ## The remainder formats normal messages (eg, to classes and instances).
188    ## Outgoing messages have different headers than incoming messages.
189    ## Note that:
190    ##   $out .= "foo";  appends "foo" to the end of the variable $out.
191    ##   lc(bar) will convert bar to lowercase.   
192    ##   "ne" does "not equal" for string comparison.
193    ##   sprintf fills in the %s's with the arguments later on the line.
194    ##   "foo"."bar" will append the two strings together.
195
196
197    if ($owl::direction eq "out") {
198        # Outgoing messages
199
200        $out .= sprintf "[outgoing to %s] / %s", $owl::recipient, $owl::time;
201        if ($owl::opcode ne "") {$out.=" op:$owl::opcode";}
202        $out.="\n";
203        $out.= "  \@bold($owl::sender)> ";
204        if ($owl::zsig ne "") {
205            my $zsig = $owl::zsig;
206            $zsig =~ s/(\n.*)+$/ [...]/;
207            if (length($zsig)+5+length($owl::sender) > 70) {
208                $out.="# ...";
209            } else {
210                $out.="# $zsig";
211            }
212        }
213    } else {
214        # Incoming messages
215
216        $out .= sprintf "[mit,%s,%s] / %s / %s", lc($owl::class), 
217                        lc($owl::instance), $owl::time, lc($owl::host);
218        if ($owl::opcode ne "") {$out.=" op:$owl::opcode";}
219        $out.="\n";
220        $out.= "  \@bold($owl::sender)> ";
221        if ($owl::zsig ne "") {
222            my $zsig = $owl::zsig;
223            $zsig =~ s/(\n.*)+$/ [...]/;
224            if (length($zsig)+5+length($owl::sender) > 70) {
225                $out.="# ...";
226            } else {
227                $out.="# $zsig";
228            }
229        }
230    }
231    $out.="\n";         
232
233    # This indents the body of the message and then appends it on.
234    $tmp=$owl::msg;
235    $tmp=~s/^/    /g;
236    $tmp=~s/\n/\n    /g;
237    $out.=$tmp;
238
239    # This makes personal messages bold.
240    if (uc($owl::class) eq "MESSAGE" &&
241        uc($owl::instance) eq "PERSONAL" &&
242       $owl::direction eq "in") {
243        $out="\@bold{".$out."}";
244    }
245
246    # Finally, this appends a newline and returns the formatted message.
247    return($out."\n");
248}
249
250## This is run when a message is received, and after
251## it has been added to the message list.
252## In most cases you won't need anything here.
253sub owl::receive_msg() {
254   
255    ## If this is uncommented, it would mark all messages
256    ## with opcode "PING" for immediate deletion:
257    #
258    # if (uc($owl::opcode) eq "PING") {
259    #    owl::command("delete -id $owl::id");
260    # }
261
262    ## If this is uncommented, it would mark all messages
263    ## with class "LOGIN" for immediate deletion:
264    #
265    # if (uc($owl::login) eq "LOGIN") {
266    #    owl::command("delete -id $owl::id");
267    # }
268
269    return 1;
270}
Note: See TracBrowser for help on using the repository browser.