mirror of
https://codeberg.org/scip/ephemerup.git
synced 2025-12-18 13:01:13 +01:00
Added mail notification support
This commit is contained in:
@@ -50,7 +50,7 @@ type ListParams struct {
|
||||
Apicontext string `json:"apicontext"`
|
||||
}
|
||||
|
||||
const Maxwidth = 10
|
||||
const Maxwidth = 12
|
||||
|
||||
/*
|
||||
Create a new request object for outgoing queries
|
||||
@@ -142,15 +142,15 @@ func HandleResponse(c *cfg.Config, resp *req.Response) error {
|
||||
fmt.Println(trace)
|
||||
}
|
||||
|
||||
if !resp.IsSuccessState() {
|
||||
return fmt.Errorf("bad response: %s", resp.Status)
|
||||
}
|
||||
|
||||
if err := json.Unmarshal([]byte(resp.String()), &r); err != nil {
|
||||
// text output!
|
||||
r.Message = resp.String()
|
||||
}
|
||||
|
||||
if !resp.IsSuccessState() {
|
||||
return fmt.Errorf("bad response: %s (%s)", resp.Status, r.Message)
|
||||
}
|
||||
|
||||
if !r.Success {
|
||||
if len(r.Message) == 0 {
|
||||
if resp.Err != nil {
|
||||
@@ -331,6 +331,7 @@ func CreateForm(w io.Writer, c *cfg.Config) error {
|
||||
SetFormData(map[string]string{
|
||||
"expire": c.Expire,
|
||||
"description": c.Description,
|
||||
"notify": c.Notify,
|
||||
}).
|
||||
Post(rq.Url)
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@ func WriteExtended(w io.Writer, response *common.Response) {
|
||||
fmt.Fprintf(w, format, "Context", entry.Context)
|
||||
fmt.Fprintf(w, format, "Created", entry.Created)
|
||||
fmt.Fprintf(w, format, "Description", entry.Description)
|
||||
fmt.Fprintf(w, format, "Notify", entry.Notify)
|
||||
fmt.Fprintf(w, format, "Url", entry.Url)
|
||||
fmt.Fprintln(w)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user