Commit graph

55 commits

Author SHA1 Message Date
eta 51821a774f Bridge through <gone/> chat state as unavailable presence
- Also, fix an error where we'd send a bogus presence if you sent an
  <active/> chat state.
2020-09-01 20:33:12 +01:00
eta 83d172f899 Upload and send images natively (!); don't block on QR code
- This commit contains initial support for uploading and sending images natively
  -- i.e. a WhatsApp image upload, instead of sending through a bare link.
- All images supported by the OPTICL library are supported; this is because WA
  needs us to generate a jpeg thumbnail for the image (which can probably be
  made smaller)
- Importantly, this functionality is currently a trivial DoS vector: simply send
  a large file (or an infinite file, like time.gif) and it ALL gets downloaded
  and buffered into RAM...!
  - At least this is limited to users who have actually registered with the
    bridge.
- Failing to send the image in any way results in an XMPP error getting reported
  back to the sender.
- Also, the initial registration QR code upload thing now happens in another
  thread.
2020-09-01 20:01:02 +01:00
eta acfa5c236d Don't send "phone number"-named roster entries in roster exchanges 2020-08-21 19:40:25 +01:00
eta 807acd42b3 When replying to presence probes, only reply to the requesting resource 2020-08-21 19:34:00 +01:00
eta e151151004 Don't spam the user with presences when they send us one
- I don't think sending the user a crapton of presence when they send us some is
  actually a good thing (and it's not doing any favours for my mobile data plan)
- Instead, let's let the user's server send us presence probes and reply to
  those (?)
2020-08-21 18:16:00 +01:00
eta 104ead0987 Handle errors that occur when trying to start a connection 2020-08-18 17:55:31 +01:00
eta 8944391580 e x t r e m e d e s i g n t h i n k i n g f a i l
- Fixed a bug in the media handling code that made everything download as
  "whatsapp media download thread".
2020-08-18 17:38:55 +01:00
eta db402312ca delete extra close-paren 2020-08-13 21:52:52 +01:00
eta 28a6303371 Add function for uploading (but not sending) media, clean up threads
- The new PUT-WHATSAPP-MEDIA-FILE can encrypt and upload a blob of file data to
  WhatsApp, and returns everything we'd need to make a protobuf message out of
  that.
- However, important functionality is still absent: whatscl needs to gain some
  support for sending protobuf messages for file uploads, and we'd also need to
  integrate with some image/video libraries in order to do related processing
  tasks.
  - For example, uploading an image requires producing a JPEG thumbnail for it,
    as well as figuring out its size.
  - Uploading audio would require conversion to Opus.
  - Maybe we could attempt to integrate with ffmpeg or something? This is likely
    to get tricky.
2020-08-06 17:18:09 +01:00
eta efbda1a002 Send the <gone/> chat state when receiving unavailable presence
- We might as well bridge this through.
2020-08-02 18:35:48 +01:00
eta a02c0fdc79 Handle chats being modified; allow the user to refresh all groups
- We now handle the :chat-modified event from whatscl, and re-fetch group
  metadata when we receive it.
- Of course, this doesn't actually help for resources which are in the MUC at
  update time; they'll need to reconnect until we have code to handle message
  stubs properly.
- Chat metadata reception now generates a message to the user, both for ease of
  debugging, and also to let them know that something happened to a groupchat
  they're in which they would otherwise not be aware of at all. (A handy link is
  also provided, if you missed the invite and want to join a MUC you're not in.)
- The new `refresh-chats` admin command forces a refresh of all group metadata
  in one big go. (Also, the help text now displays the current version.)
2020-08-02 12:59:59 +01:00
eta b47828c5c1 Fix sending read receipts in MUCs
- The "by" attribute of the <stanza-id/> element wasn't being set correctly (it
  was just set to the localpart instead of the full JID, which is out of spec).
- This meant that Conversations (at least) wouldn't trust it, and would try to
  use the origin-id instead, which couldn't be looked up when a chat marker was
  sent to the bridge.
- This fixes that.
- (and adds another space to the put-url debug info)
2020-08-02 11:05:52 +01:00
eta 5f4bcb6c8f Don't unconditionally include disco info in features
- This breaks the entity caps, because there's duplication.
2020-08-01 18:00:06 +01:00
eta 99df4a56fe Don't differentiate between account and resource in disco#info
- So the entity caps stuff didn't actually work, because we don't implement
  XEP-0030 properly and don't honour the "node" attribute on the query.
- To hack around this, we misimplement XEP-0030 some more, and always return the
  bridged user disco info list, even if they ask for the bare JID instead of the
  full JID. That way, the caps stuff works as it should.
2020-08-01 17:54:37 +01:00
eta 599123dbef Generate entity caps & process disconnect messages
- The bridge should now support XEP-0115 Entity Capabilities, which actually
  brings us into compliance with XEP-0085 Chat State Notifications (there were
  clients, like Miranda NG, that wouldn't send to us without us actually doing
  this XEP and advertising support in disco#info).
- We now handle the :disconnect message from whatscl, which lets us properly
  deal with the connection being removed from the app or replaced with another
  session. (Before, this would drop the connection, it'd loop and retry, and
  then hit a status code error on login; this way is slightly cleaner and also
  prevents the bridge getting into a war with another bridge.)
- The :ws-open whatscl event never existed. The bridge was doing just fine
  not executing its handler, so it's just been removed. Future work might
  improve the amount of spam sent to the user about the bridge state.
2020-08-01 16:58:50 +01:00
eta b54fec4aa9 Adapt WA-HANDLE-ERROR-STATUS-CODE to recent whatscl changes
- We can now differentiate fatal login errors from other types of errors. For
  non-fatal errors, we just send an informational warning message.
  (Login errors kill the connection as before.)
2020-08-01 15:53:29 +01:00
eta f951fab325 :error now emits a backtrace as well, so handle that 2020-07-23 07:58:04 +01:00
eta 37b3ae2014 don't send presence subscription requests for nameless numbers 2020-07-13 22:34:15 +01:00
eta c59400b459 fix crash issue on incomplete / denied group metadata 2020-07-12 10:46:46 +01:00
eta c9f27dc69a tentative chopped QR issue fix 2020-07-10 20:42:12 +01:00
eta 2e4e375196 handle missing subject in group metadata 2020-07-10 20:36:55 +01:00
eta 5ce6d47266 add MUC disco#items handler, fix children including text DOM nodes 2020-07-07 21:27:21 +01:00
eta a312057849 remove some whitespace 2020-06-25 17:26:26 +01:00
eta 0962c5d488 *: move 750 LoC from 'stuff.lisp' into other sensibly-named files 2020-06-25 16:56:36 +01:00
eta 6c0e61f2a5 whoops 2020-06-19 12:55:48 +01:00
eta 26620cf36b add Content-Length header when doing uploads 2020-06-19 12:17:38 +01:00
eta 242614fc68 README, LICENSE, and general user friendliness 2020-05-28 18:33:03 +01:00
eta b8760ac948 Initial support for typing notifications / chat state (1-to-1 only) 2020-05-28 14:02:37 +01:00
eta 3d3393c5c5 fix RETURN bug 2020-04-29 21:38:40 +01:00
eta 93e8e3aca3 don't crash on new chat 2020-04-27 15:14:53 +01:00
eta 401ec20930 Only do roster exchange when a command is issued; minor fixes 2020-04-24 16:28:14 +01:00
eta bab110bea0 add some basic (hacky) support for XEP-0359 2020-04-21 13:45:49 +01:00
eta 08b8ac8334 fix the whatsxmpp admin user thing 2020-04-21 09:09:40 +01:00
eta 39001728b3 slightly hacky but functional groupchat / MUC support 2020-04-12 08:27:04 +01:00
eta a3a660507e -contact-avatar => -contact-presence (oops) 2020-04-07 16:20:33 +01:00
eta bdc817a068 oops, don't break photos 2020-04-07 14:45:53 +01:00
eta 9d02fb6050 Handle picture & status changes, bridge status as well as picture 2020-04-07 13:06:26 +01:00
eta 8e70490d78 Add support for receiving WhatsApp media files! 2020-04-07 11:51:04 +01:00
eta 2a1e7303d0 name your damn locks, people 2020-04-06 21:22:41 +01:00
eta 297170ae6b display quoted message text, if there is any 2020-04-06 20:46:33 +01:00
eta 3985aba03f I swear, this stream is gonna cause anger management issues 2020-04-05 19:11:02 +01:00
eta 2604bbe2cb really dodgy SWANK code 2020-04-05 18:13:14 +01:00
eta f1ea7070c6 Do nothing on the main thread to prevent it exiting 2020-04-05 17:06:31 +01:00
eta 590390347b don't overwhelm everyone with copious amounts of XMPP output 2020-04-05 16:46:20 +01:00
eta 3337500b90 make more deployable, support XEP-0144 for BIG contact 2020-04-05 16:31:18 +01:00
eta 1b169e7741 remove stray INVOKE-DEBUGGER calls 2020-04-05 15:08:56 +01:00
eta 47024701a5 Handle avatars (!) and various types of presence requests 2020-04-05 15:05:27 +01:00
eta 29eecd2b03 Bridge read and delivery receipts as well, yay 2020-04-05 12:04:19 +01:00
eta 12cb121100 Handle presence subscriptions, vcard-temp, and other stuff 2020-04-04 23:12:39 +01:00
eta e2add1d98f Actually reconnect users & connect on bridge start 2020-04-04 17:18:26 +01:00