summaryrefslogtreecommitdiff
path: root/qkbox/toot.scm
diff options
context:
space:
mode:
Diffstat (limited to 'qkbox/toot.scm')
-rw-r--r--qkbox/toot.scm24
1 files changed, 22 insertions, 2 deletions
diff --git a/qkbox/toot.scm b/qkbox/toot.scm
index 8241794..ad6b742 100644
--- a/qkbox/toot.scm
+++ b/qkbox/toot.scm
@@ -52,7 +52,12 @@
(make-parameter (getenv "MASTODON_ACCESS_TOKEN")))
(define (created-at-string->date str)
- (string->date str "~Y-~m-~dT~H:~M~S.~NZ"))
+ (time-utc->date
+ (date->time-utc
+ (string->date str "~Y-~m-~dT~H:~M:~S.~N~z"))))
+
+(define (creation-time->string date)
+ (date->string date "~4"))
(define*-public (post text
#:key
@@ -154,6 +159,19 @@
(assoc-ref (notification-json notification)
"created_at")))
+(define* (display-notification notification #:key (port (current-output-port)))
+ (let ((account (notification-account notification))
+ (status (notification-status notification))
+ (time (notification-creation-time notification)))
+ (format port
+ "[NOTIFICATION] ~:@(~a~)~%~a ~a ~a~%> "
+ (notification-type notification)
+ (fetch-avatar-static
+ (account-avatar-static account))
+ (account-to-string account)
+ (creation-time->string time))
+ (display-status (notification-status notification))))
+
(define-public (status-public? status)
(eq? 'public (status-visibility status)))
@@ -176,9 +194,11 @@
(cond
(else
(format port
- "~s ~a~@?~@?~@?~@?~@?~%~@?~@?"
+ "~s ~a ~a~@?~@?~@?~@?~@?~%~@?~@?"
(status-avatar-pict status/original)
(account-to-string account)
+ (creation-time->string
+ (status-creation-time status/original))
"~@[~% * status-id: ~s~]"
(and display-id? (status-id status/original))
"~@[~% * visibility: ~:@(~a~)~]"