summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Bex <peter@more-magic.net>2011-06-09 22:59:36 +0200
committerPeter Bex <peter@more-magic.net>2011-06-09 22:59:36 +0200
commitac75f3de9f4c0e0b1beca43fd9c710eea99696bb (patch)
tree79db799e62a39fa559b8071af7e701bd60b85629
parentde61dc2d63183f8e75e7348c1050e85dfbf267d2 (diff)
downloadsmsmatrix-ac75f3de9f4c0e0b1beca43fd9c710eea99696bb.tar.gz
Map statuscode and timestamp to numbers, for convenience
-rw-r--r--smsmatrix.scm15
1 files changed, 12 insertions, 3 deletions
diff --git a/smsmatrix.scm b/smsmatrix.scm
index fd68fff..77c2441 100644
--- a/smsmatrix.scm
+++ b/smsmatrix.scm
@@ -225,10 +225,11 @@
(error 'message-status
"Sanity check failed: message ID differs from the one requested!"
(alist-ref 'id res) message-id))
- (values (string->number (alist-ref 'response res)) ; May be omitted
+ (values (string->number (alist-ref 'response res eq? "")) ; May be omitted
(string->number (alist-ref 'timestamp res))
(alist-ref 'timezone res)
- status status-text))))
+ (string->number status)
+ status-text))))
;; Not really part of the "API" as such since it returns something completely
;; different than =-separated lists of key/value pairs and "email" vs "username"
@@ -264,6 +265,14 @@
(error-on-bad-result-code
'send-sms status status-text pin)))
res))
- res)))
+ (map (lambda (entry)
+ (map (lambda (key/value)
+ (let ((key (car key/value))
+ (value (cdr key/value)))
+ (case key
+ ((statuscode timestamp) (cons key (string->number value)))
+ (else key/value))))
+ entry)
+ res)))))
) \ No newline at end of file