Skip to content
Browse files

* warn about outdated doc, move to message.scm

  • Loading branch information...
1 parent 0258a52 commit be35f4964da285b7e6317c5db65671e07b7c2b2f djcb committed Jan 1, 2012
Showing with 67 additions and 20 deletions.
  1. +2 −0 guile/mu/README
  2. +65 −0 guile/mu/message.scm
  3. +0 −20 guile/mu/msg.scm
View
2 guile/mu/README
@@ -1,3 +1,5 @@
+* OUTDATED *
+
* README
** What is muile?
View
65 guile/mu/message.scm
@@ -0,0 +1,65 @@
+;;
+;; Copyright (C) 2011-2012 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
+;;
+;; This program is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by the
+;; Free Software Foundation; either version 3, or (at your option) any
+;; later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+;;
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, write to the Free Software Foundation,
+;; Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+(define-module (mu message)
+ :use-module (oop goops)
+ :use-module (mu)
+ :export (
+ <mu-message>
+ body
+ header
+ contacts
+ ))
+
+(define-class <mu-message> ()
+ (msg #:init-keyword #:msg)) ;; the MuMsg-smob we're wrapping
+
+(define-syntax define-getter
+ (syntax-rules ()
+ ((define-getter method-name field)
+ (begin
+ (define-method (method-name (msg <mu-message>))
+ (mu:msg:field (slot-ref msg 'msg) field))
+ (export method-name)))))
+
+(define-getter bcc mu:bcc)
+(define-getter body-html mu:body-html)
+(define-getter body-txt mu:body-txt)
+(define-getter cc mu:cc)
+(define-getter date mu:date)
+(define-getter flags mu:flags)
+(define-getter from mu:from)
+(define-getter maildir mu:maildir)
+(define-getter message-id mu:message-id)
+(define-getter path mu:path)
+(define-getter priority mu:prio)
+(define-getter references mu:refs)
+(define-getter size mu:size)
+(define-getter subject mu:subject)
+(define-getter tags mu:tags)
+(define-getter to mu:to)
+
+(define-method (body (msg <mu-message>))
+ (or (body-txt msg) (body-html msg)))
+
+(define-method (header (msg <mu-message>) (hdr <string>))
+ "Get an arbitrary header HDR from message MSG."
+ (mu:msg:header (slot-ref msg 'msg) hdr))
+
+(define-method (contacts (msg <mu-message>) contact-type)
+ (mu:msg:contacts (slot-ref msg 'msg) contact-type))
View
20 guile/mu/msg.scm
@@ -1,20 +0,0 @@
-;;
-;; Copyright (C) 2011 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
-;;
-;; This program is free software; you can redistribute it and/or modify it
-;; under the terms of the GNU General Public License as published by the
-;; Free Software Foundation; either version 3, or (at your option) any
-;; later version.
-;;
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-;;
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program; if not, write to the Free Software Foundation,
-;; Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-(define-module (mu msg))
-(load-extension "libguile-mu" "mu_guile_init")

0 comments on commit be35f49

Please sign in to comment.
Something went wrong with that request. Please try again.