diff options
author | Eric Wong <e@80x24.org> | 2016-06-20 00:57:16 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-06-20 00:57:38 +0000 |
commit | 4b313dc74bc9bb84a542b7ec920cdb92879e7523 (patch) | |
tree | bdea400b15979d0d4206aa8aa840c71ed956eaca /lib/PublicInbox/Inbox.pm | |
parent | 2724361ab69cd071c970c66e076784c582c76e42 (diff) | |
download | public-inbox-4b313dc74bc9bb84a542b7ec920cdb92879e7523.tar.gz |
Favor Inbox objects as our primary source of truth to simplify our code. This increases our coupling with PSGI to make it easier to write tests in the future. A lot of this code was originally designed to be usable standalone without PSGI or CGI at all; but that might increase development effort.
Diffstat (limited to 'lib/PublicInbox/Inbox.pm')
-rw-r--r-- | lib/PublicInbox/Inbox.pm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm index c982d0b4..faab03ce 100644 --- a/lib/PublicInbox/Inbox.pm +++ b/lib/PublicInbox/Inbox.pm @@ -7,6 +7,7 @@ use strict; use warnings; use Scalar::Util qw(weaken); use PublicInbox::Git; +use PublicInbox::MID qw(mid2path); sub new { my ($class, $opts) = @_; @@ -90,4 +91,15 @@ sub nntp_usable { $ret; } +sub msg_by_path ($$;$) { + my ($self, $path, $ref) = @_; + # TODO: allow other refs: + git($self)->cat_file('HEAD:'.$path, $ref); +} + +sub msg_by_mid ($$;$) { + my ($self, $mid, $ref) = @_; + msg_by_path($self, mid2path($mid), $ref); +} + 1; |