aboutsummaryrefslogtreecommitdiffstats
path: root/matrix-room.c
Commit message (Collapse)AuthorAgeFilesLines
* fix some memory leaks (#135)iv4nhoe2023-02-071-6/+16
|
* Build failure workaround: _on_typingDr. David Alan Gilbert2021-06-261-0/+1
| | | | | | | | | | | | We have a report of gcc not liking old_user_ids being unitialised; but as far as I can tell it doesn't matter when old_len is set to 0 because the loop won't happen. Set it to NULL and hope it placates gcc. Fixes: 108 Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* Add an option to get markdown, not HTMLMiklos Vajna2021-06-111-2/+8
| | | | Fixes #116
* Do not include gcrypt.h in matrix-room.cStefan Strogin2018-09-201-2/+0
| | | | Nothing from gcrypt is used in matrix-room.c.
* e2e: Wire in media decryptionDr. David Alan Gilbert2018-02-251-0/+33
| | | | | | Use the previously stashed crypto data to decrypt the image. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Stash key info for encrypted imagesDr. David Alan Gilbert2018-02-251-14/+45
| | | | | | | m.image messages in the e2e world have a different format and include keys. Decode the extra structures. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Cleanup inbound megolm sessions in memoryDr. David Alan Gilbert2018-02-251-0/+1
| | | | | | Cleanup on closing the plugin or leaving a conversation. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Route decrypted messages back upDr. David Alan Gilbert2018-02-251-2/+25
| | | | | | Parse the decrypted JSON and route it back up to the room code. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Decrypt m.room.encryptedDr. David Alan Gilbert2018-02-251-0/+10
| | | | | | | Decrypt m.room.encrypted messages sent to a room; these come out with normal events. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* Merge pull request #62 from radiocane/mediaDave Gilbert2018-02-241-60/+112
|\ | | | | Handle media messages (m.video, m.audio, m.file)
| * [matrix-room] Update thumbnail request to r0.3.0White_Rabbit2018-02-221-11/+32
| | | | | | | | | | | | | | | | With r0.3.0 thumbnail_info and thumbnail_url for m.image and m.file have been moved from content to content.info. With this commit those objects are looked for at the new location and if they're not found, the old location is checked. Furthermore, if the thumbnail provided is too big, we ask the server to make a thumbnail of it.
| * Improve media handlingWhite_Rabbit2018-02-221-59/+90
| | | | | | | | | | | | | | | | Handle m.video, m.file, m.audio and m.image in _handle_incoming_media. Remove _handle incoming_image. On incoming media, always print a chat message with the download link and mimetype/size. If a thumbnail_url is available and the thumbnail size is small, download and show that. Otherwise, only for m_image, ask for a server generated thumbnail.
* | typing: Fix crash on typing notification to someone not presentDr. David Alan Gilbert2018-02-201-9/+13
|/ | | | | | | | | I've seen a crash where the user_id doesn't appear to be a member of the room; I'm guessing they just left or only just arrived and we got the typing notification after/before. Fixes: 61ee52f3230724b5c1e8f81caeb16ce7887d183c Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* Responding to PR commentsEion Robb2017-05-281-9/+1
| | | | | * Comment about using state table for ephermal events * Move JSON handling into matrix-api
* Merge branch 'master' into typing-notifications3Eion Robb2017-05-281-4/+30
|\
| * Fix whitespace and a memleakEion Robb2017-05-281-8/+10
| |
| * Support HTML formatting on sending/receiving messagesEion Robb2017-05-231-5/+13
| |
| * Support display of room topicsEion Robb2017-03-121-0/+16
| |
* | Send/receive typing notificationsEion Robb2017-03-121-0/+98
|/ | | | using the "Group Typing Notifications" plugin
* Merge pull request #25 from penguin42/escaping-fixRichard van der Hoff2017-01-031-5/+11
|\ | | | | Escape incoming message bodies
| * Escape incoming message bodiesDr. David Alan Gilbert2017-01-021-5/+11
| | | | | | | | | | | | | | | | | | Purple intereprets incoming message bodies as pseudo HTML, and thus eats <text> - I've not seen it do anything really bad on Pidgin (I can trigger bold but not anything more insecure); not sure other purple frontends. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* | Download thumbnails for images that are too largeDr. David Alan Gilbert2016-12-271-7/+22
|/ | | | | | | | | | | | | | When we decide from the image info that an image is too large, try a thumb instead. Pick 640x480 because a) we need to pick a size and b) That's the right size. c) We should make it configurable. (We could also try this if we didn't have the image info when we get the error). Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* Download imagesDr. David Alan Gilbert2016-11-131-0/+160
| | | | | | | | | | Download images received in events, adding them to Purple's image cache. There are probably improvements that can be made in failure paths and also in trying to use thumbnails. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* Pass body/len/content_type to completion callbackDr. David Alan Gilbert2016-11-131-2/+4
| | | | | | | | When a response can't be parsed as JSON pass the body and length to the callback. Also add the content_type. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* Unescape the HTML-escaped HTML.Bryce Chidester2016-10-251-3/+9
| | | | | | Matrix uses JSON to pass messages, and the Matrix API functions are perfectly capable of handling the required escaping. HTML needs no escaping. Signed-off-by: Bryce Chidester <bryce@cobryce.com>
* Allow building on libpurple 2.10.xDr. David Alan Gilbert2016-10-161-2/+4
| | | | | | | | | | | In 2f143058d I used the purple_util_fetch_url_request_data_len_with_account which turns out to be new in libpurple 2.11 and ubuntu is still stuck on 2.10. This is a build hack that allows building on 2.10 but doesn't allow sending images. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* Send inserted imagesDr. David Alan Gilbert2016-09-031-0/+218
| | | | | | | | | | | | | | | | | | Turn on purple's image facility and cause the messages to be sent. There are two tricky parts to this: a) Purple's idea is a message that can include an image anywhere in it; while Matrix's idea is that you have text events and image events but currently no combo events. My (hacky) solution here is to split purple messages into the text and image components. b) Matrix's images are files that need uploading before the event is sent, and the upload process gives a uri back that must be included in the event. That means we have to somehow delay sending the event until we have the file uploaded. I solve that by using the event hook I added in an earlier commit. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* event hooksDr. David Alan Gilbert2016-09-031-2/+8
| | | | | | | | | | | Some events need to do something else before the event can be transmitted, and indeed the contents of the event aren't necessarily known until that other thing has happened. Add a hook that gets called when the event is ready to be sent and when the event is to be free'd. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* Send outgoing emotesDr. David Alan Gilbert2016-07-101-2/+9
| | | | | | Spot the /me in what we get from pidgin and use m.emote msgtype. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* Handle incoming emotesDr. David Alan Gilbert2016-07-101-2/+15
| | | | | | Spot the event msgtype m.emote and add a /me to what we feed purple. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* Update for /sync response changesRichard van der Hoff2015-11-191-4/+3
| | | | | https://github.com/matrix-org/matrix-doc/pull/165 changes the format of the /sync response. Update our code to accept it.
* Fix a bug which stopped room name changes being handledRichard van der Hoff2015-11-191-1/+2
| | | | If a room's name changed, we didn't update the UI.
* Fix infinite loop in matrix_room_displayname_to_useridRichard van der Hoff2015-11-031-6/+7
| | | | | Double-clicking a user in the chat window would cause an infinite loop. Because apparently I fail at linked-lists.
* Hopefully fix bugs where the member list got out of syncRichard van der Hoff2015-11-031-57/+228
| | | | | | | | | | We needed better tracking of what we had told purple was each member's displayname. It was terribly confusing having matrix-roommembers try to track it implicitly, which was causing bugs where we were getting out of sync. Instead, let matrix-roommembers hold opaque data for each member, which matrix-room then uses to keep track of the purple displayname. Then move a bunch of the member-update-handling stuff back into matrix-room.
* Include invited members in room name calculationsRichard van der Hoff2015-11-031-1/+1
| | | | We want to include invited members when we are considering names for rooms.
* Implement get_cb_real_nameRichard van der Hoff2015-11-021-0/+9
| | | | | Fixing this means purple is slightly less confused about who the users in our chats are.
* Show correct displayname on our own outgoing messagesRichard van der Hoff2015-11-021-1/+11
| | | | | Make the displayname on our sent messages match that in the member list for the room.
* Handle incoming room invitesRichard van der Hoff2015-11-021-2/+2
| | | | | Propagate received invites to the UI, and correctly handle accepting/refusing them.
* Refactor the statetable out to a separate fileRichard van der Hoff2015-10-301-195/+65
| | | | | Apart from generally being cleaner, we're going to want to use the statetable in isolation of rooms, to handle invites.
* Leave rooms when pidgin tells us to.Richard van der Hoff2015-10-301-7/+35
| | | | If a user unticks 'persistent', then closes a tab, we should leave the room.
* Move the room member table management out to a separate fileRichard van der Hoff2015-10-291-285/+101
| | | | | | | | | Trying to keep the size of matrix-room.c under control, move the membertable management bits out to a separate file. Also do away with the special handling for the first /sync of a room, and instead *always* group together member arrivals/departures until after we've finished handling the state table.
* Set the 'persistent' flag on rooms when added to the buddy listRichard van der Hoff2015-10-291-29/+7
| | | | The 'persistent' behaviour matches the matrix model much better.
* Add an indication of the members of a roomRichard van der Hoff2015-10-271-122/+379
| | | | | | | | An initial implementation for displaying the people in a room. This isn't very nice, and the code is somewhat thrown together as a prototype/proof-of-concept for now. We probably want to refactor matrix-room.c, which is now altogether too unwieldy. It probably also makes sense to try to do some of this stuff on the server.
* Request a full_state sync the first time we connect to an account.Richard van der Hoff2015-10-271-50/+0
| | | | | | This requires the new full_state support from https://github.com/matrix-org/synapse/pull/332. It's much cleaner than trying to request the state the first time we hear about a room.
* Better room names for one-to-one chatsRichard van der Hoff2015-10-261-13/+137
| | | | Give rooms a name according to who's in it, if there is no proper name.
* Update the room state on first messageRichard van der Hoff2015-10-221-1/+52
| | | | | Now that we persist the next_batch identifier, we no longer get all of the state for a room, so we need to explicitly fetch it on initial sync.
* Don't send new messages when the connection is droppingRichard van der Hoff2015-10-221-19/+29
|
* Refactor the connection codeRichard van der Hoff2015-10-221-2/+1
| | | | | | | Move all matrix-login and bits of matrix-sync into matrix-connection, where it seems to make more sense. Also move MatrixConnectionData into matrix-connection.h
* Rename MatrixAccount to MatrixConnectionDataRichard van der Hoff2015-10-221-7/+8
| | | | | This structure comes and goes with each connection, so rename it to better reflect its lifecycle.
* Implement a 'cancel' method for the matrix-api interfaceRichard van der Hoff2015-10-221-1/+1
| | | | | | We're going to need to do proper cancelling of API requests, which means passing around enough state to make that possible, so return the MatrixApiRequestData * from matrix_api_*.