Documentation ¶
Overview ¶
configuration.go: module for managing message properties * * Copyright (C) 2016-2018 Clemens Fries <github-lettersnail@xenoworld.de> * * 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 of the License, 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, see <http://www.gnu.org/licenses/>.
consts.go: global constants * * Copyright (C) 2016-2018 Clemens Fries <github-lettersnail@xenoworld.de> * * 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 of the License, 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, see <http://www.gnu.org/licenses/>.
message.go: module for managing message information * * Copyright (C) 2016-2018 Clemens Fries <github-lettersnail@xenoworld.de> * * 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 of the License, 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, see <http://www.gnu.org/licenses/>.
util.go: various utility functions * * Copyright (C) 2016-2018 Clemens Fries <github-lettersnail@xenoworld.de> * * 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 of the License, 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, see <http://www.gnu.org/licenses/>.
Index ¶
- Constants
- func ParseTime(datetime string) (time.Time, error)
- func SplitMessage(text []string) ([]string, []string)
- type Configuration
- func (c *Configuration) DumpConfig() []string
- func (c *Configuration) Get(key string) string
- func (c *Configuration) Load(text []string)
- func (c *Configuration) MergeWith(src *Configuration)
- func (c *Configuration) MergeWithDocOptArgs(cmd string, args *map[string]interface{})
- func (c *Configuration) MergeWithIni(cmd string)
- func (c *Configuration) Set(key string, value string)
- type Message
- type Messages
Constants ¶
const ( TIME_FORMAT = "15:04" DATE_FORMAT = "2006-01-02" DATETIME_FORMAT = DATE_FORMAT + " " + TIME_FORMAT DIR_TODO = "todo" DIR_DRAFTS = "drafts" DIR_ERRORS = "errors" DIR_DONE = "done" CMD_USAGE = "usage" CMD_RUN = "run" CONF_WORKDIR = "workdir" CONF_DATE = "date" CONF_DAYS = "days" CONF_SUBJECT = "subject" CONF_TO = "to" CONF_FROM = "from" CONF_REPLY_TO = "reply-to" CONF_CC = "cc" CONF_BCC = "bcc" CONF_CONFIG_FILENAME = "config" CONF_SMTP_SERVER = "server" CONF_SMTP_PORT = "port" CONF_SMTP_INSECURE = "insecure" CONF_NOT_BEFORE = "not-before" CONF_NOT_AFTER = "not-after" )
Project wide constants.
Variables ¶
This section is empty.
Functions ¶
func SplitMessage ¶
Split a text in two parts on the first blank line.
Types ¶
type Configuration ¶
func NewConfiguration ¶
func NewConfiguration() *Configuration
func (*Configuration) DumpConfig ¶
func (c *Configuration) DumpConfig() []string
Dump the configuration as strings in the form `key: value`.
func (*Configuration) Get ¶
func (c *Configuration) Get(key string) string
func (*Configuration) Load ¶
func (c *Configuration) Load(text []string)
Load configuration from an array of strings in the form `key: value`.
func (*Configuration) MergeWith ¶
func (c *Configuration) MergeWith(src *Configuration)
Merge the `src` configuration into this configuration.
func (*Configuration) MergeWithDocOptArgs ¶
func (c *Configuration) MergeWithDocOptArgs(cmd string, args *map[string]interface{})
Merge arguments from the DocOpt parser into a configuration map. All arguments that are not `nil` and start with "--" will be merged. Booleans will be converted to strings.
func (*Configuration) MergeWithIni ¶
func (c *Configuration) MergeWithIni(cmd string)
Merges the "default" and the "cmd" section from CONF_CONFIG_FILENAME.
func (*Configuration) Set ¶
func (c *Configuration) Set(key string, value string)
type Message ¶
type Message struct { Conf Configuration Body []string Name string }
func NewMessageFromFile ¶
Construct new Message from the given file.
func (*Message) Verify ¶
Verify if a message has all necessary parameters. We need at least to, from, subject, and date. This will also verify optional address lists, etc.
func (*Message) WriteToFile ¶
Write a message to a file, such that it could be loaded again.
type Messages ¶
type Messages []Message
Supporting sort.Interface.
func NewMessagesFromDirectory ¶
Load all messages in the given directory.