Add functions for *uploading* media (but not sending)
- This is a large part of the work toward being able to send images/video/etc.
- We can now encrypt stuff according to whatsapp's requirements, ask for an
upload slot, and do the uploading (but the actual uploading is outsourced to
the library consumer right now)
- Still missing, however, is the ability to stuff the necessary bits of info
into a WhatsApp protobuf message and actually send it.
"Gets the HKDF application info for the media type symbol TYPE."
@ -118,11 +122,36 @@ TYPE is a symbol (one of :IMAGE, :VIDEO, :AUDIO or :DOCUMENT) specifying what ty
@@ -118,11 +122,36 @@ TYPE is a symbol (one of :IMAGE, :VIDEO, :AUDIO or :DOCUMENT) specifying what ty
@ -194,6 +194,29 @@ CALLBACK, if provided, specifies a function to run with the reply sent by WhatsA
@@ -194,6 +194,29 @@ CALLBACK, if provided, specifies a function to run with the reply sent by WhatsA
:presence
:callback(function-check-status:send-presence)))
(defunparse-media-conn-response(resp)
"Parse the response to START-MEDIA-UPLOAD provided (RESP). If it is valid, return the values (AUTH-TOKEN TTL HOSTNAME-LIST); else, return NIL."
(labels
;; This is the kind of thing the Maybe monad is excellent at. We don't have
"Request a media upload slot from WhatsApp. Calls CALLBACK like (FUNCALL CALLBACK CONN AUTH-TOKEN TTL HOSTS); if the slot request fails, AUTH-TOKEN, TTL, and HOSTS will all be NIL."
(send-ws-messageconn`("query""mediaConn")
(lambda(connresp)
(multiple-value-bind(auth-tokenttlhosts)
(parse-media-conn-responseresp)
(without-wac-lock(conn)
(funcallcallbackconnauth-tokenttlhosts))))))
(defunget-profile-picture(connjidcallback)
"Try and get a profile picture thumbnail for JID. Calls CALLBACK with CONN as first argument and then a URL (or NIL if none could be found)"