]>
Commit | Line | Data |
---|---|---|
82af6c12 MG |
1 | #!/usr/bin/perl |
2 | use 5.014000; | |
3 | use strict; | |
4 | use warnings; | |
5 | ||
6 | use App::Lastmsg; | |
7 | ||
8 | App::Lastmsg::run; | |
9 | ||
10 | __END__ | |
11 | ||
12 | =encoding utf-8 | |
13 | ||
14 | =head1 NAME | |
15 | ||
16 | lastmsg - last(1) semblance for your inbox | |
17 | ||
18 | =head1 SYNOPSIS | |
19 | ||
20 | # in ~/.lastmsgrc | |
21 | inbox: | |
22 | - /home/MGV/mail/inbox | |
23 | - /home/MGV/mail/folder | |
24 | sent: | |
25 | - /home/MGV/mail/sent | |
26 | track: | |
27 | bestfriend: | |
28 | - best@friend.com | |
29 | - best.friend@freemail.com | |
30 | someguy: SOMEGUY@cpan.org | |
31 | nobody: | |
32 | - nobody@example.com | |
33 | ||
34 | # in your shell | |
35 | mgv@somehost ~ $ lastmsg | |
36 | bestfriend best@friend.com Sat 31 Dec 2016 12:34:56 EET | |
37 | someguy SOMEGUY@cpan.org Thu 20 Nov 2016 12:00:00 EET | |
38 | nobody NOT FOUND | |
39 | ||
40 | =head1 DESCRIPTION | |
41 | ||
42 | lastmsg reads your mail folders looking for emails you exchanged with | |
43 | a given set of people. Then for each person in the set it prints the | |
44 | time you last received an email from or sent an email to them and the | |
45 | email address used. | |
46 | ||
47 | The script takes no arguments (the settings are taken from a | |
48 | configuration file), and it prints a three-column table where the | |
49 | first column is the ID of a person, the second column is the email | |
50 | address last used (empty if you've never exchanged an email with that | |
51 | person), and the last column is the date of last contact (or the | |
52 | string C<NOT FOUND> if you've never exchanged an email). The rows are | |
53 | sorted by date of last contact (with the most recently contacted | |
54 | people at the top), and the people that you've never exchanged an | |
55 | email with are at the end. | |
56 | ||
57 | The configuration is in YAML format. Three keys are recognised: | |
58 | ||
59 | =over | |
60 | ||
61 | =item B<inbox> | |
62 | ||
63 | The path(s) to your inbox and other incoming mail folders (a single | |
64 | string or a list of strings). The C<From> field of these emails is | |
65 | scanned. | |
66 | ||
67 | If not provided, it defaults to F</var/mail/$ENV{USER}> and | |
68 | F<$ENV{HOME}/Maildir/>. | |
69 | ||
70 | B<NOTE:> See L<Email::FolderType> for information on how the type of a | |
71 | folder is identified. In short, the suffix of the folder is analyzed: | |
72 | If F</>, the format is Maildir. If F</.>, the format is MH. If F<//>, | |
73 | the format is Ezmlm. Otherwise, some heuristics are checked and the | |
74 | fallback is Mbox. | |
75 | ||
76 | =item B<sent> | |
77 | ||
78 | The path(s) to your sent and other outgoing mail folders (a single | |
79 | string or a list of strings). The C<To>, C<Cc>, and C<Bcc> fields of | |
80 | these emails are scanned. | |
81 | ||
82 | If not provided, it default to an empty list. See B<NOTE:> above for | |
83 | information on how the type of a folder is identified. | |
84 | ||
85 | =item B<track> | |
86 | ||
87 | A hash of people to track. Each entry represents a person. The key is | |
88 | the ID of that person (used for display), and the value is the email | |
89 | address of that person or a list of email addresses of that person. | |
90 | ||
91 | If not provided, the script will die with an error. | |
92 | ||
93 | =back | |
94 | ||
95 | The configuration file can be named F<lastmsgconfig>, | |
96 | F<lastmsg.config>, F<lastmsgrc>, or F<.lastmsgrc> and can be placed in | |
97 | the current directory, in your home directory, in F</etc/>, and in | |
98 | F</usr/local/etc/>. See L<Config::Auto> for more information. | |
99 | ||
100 | =head1 ENVIRONMENT | |
101 | ||
102 | The only recognised environment variable is B<LASTMSG_DEBUG>, which if | |
103 | set to a true value causes the script to emit a lot of information | |
104 | about what it is doing. | |
105 | ||
106 | =head1 TODO | |
107 | ||
108 | Should handle IRC and IM logs as well, not just emails. Should have | |
109 | better tests. | |
110 | ||
111 | =head1 AUTHOR | |
112 | ||
113 | Marius Gavrilescu, E<lt>marius@ieval.roE<gt> | |
114 | ||
115 | =head1 COPYRIGHT AND LICENSE | |
116 | ||
117 | Copyright (C) 2016 by Marius Gavrilescu | |
118 | ||
119 | This library is free software; you can redistribute it and/or modify | |
120 | it under the same terms as Perl itself, either Perl version 5.24.1 or, | |
121 | at your option, any later version of Perl 5 you may have available. | |
122 | ||
123 | ||
124 | =cut |