Commit Graph

457 Commits

Author SHA1 Message Date
Gergely Polonkai 2a098de9bf Add differs() method to Matrix.ImageIngo
Signed-off-by: Gergely Polonkai <gergely@polonkai.eu>
2016-03-22 10:47:16 +00:00
Gergely Polonkai 2dc42021b6 Add set_user_level() and set_event_level() to Matrix.Event.RoomPowerLevels
Signed-off-by: Gergely Polonkai <gergely@polonkai.eu>
2016-03-22 10:11:14 +00:00
Gergely Polonkai a73866a918 Fix formatting in matrix-client.vala 2016-03-21 17:25:04 +01:00
Gergely Polonkai 5fedf09f76 Define polling-started and polling-stopped signals
Client.sync() invokes them when polling is started or stopped for any
reason.

Signed-off-by: Gergely Polonkai <gergely@polonkai.eu>
2016-03-21 15:48:31 +01:00
Gergely Polonkai 457371b25b Fix call to g_mkdir_with_parents() in test-client
Signed-off-by: Gergely Polonkai <gergely@polonkai.eu>
2016-03-21 15:37:49 +01:00
Gergely Polonkai 4c6ffe59f4 Documentation fix for Matrix.Room.get_member()
Signed-off-by: Gergely Polonkai <gergely@polonkai.eu>
2016-03-21 15:37:24 +01:00
Gergely Polonkai 758ee3ae81 Add documentation to properties and methods
Signed-off-by: Gergely Polonkai <gergely@polonkai.eu>
2016-03-21 14:23:17 +01:00
Gergely Polonkai 1d16628861 Start polling in test client upon a successful login
This was removed unintentionally two commits ago.

Signed-off-by: Gergely Polonkai <gergely@polonkai.eu>
2016-03-21 11:51:24 +01:00
Gergely Polonkai 6ab67b44be Do a token_refresh if forbidden(ish) error received 2016-03-21 10:45:27 +00:00
Gergely Polonkai d9a032ac28 Make test client save its state and load it on startup
The save data goes to $XDG_CACHE_HOME/matrix-glib-sdk/base_url_sha1

Signed-off-by: Gergely Polonkai <gergely@polonkai.eu>
2016-03-21 10:39:16 +00:00
Gergely Polonkai 33bb63e4f1 Add debug output to state load/save 2016-03-20 18:46:59 +00:00
Gergely Polonkai 21ee03d030 Fix matrix_http_api_set_base_url()
It didn’t save the actual base URL.
2016-03-20 14:25:27 +00:00
Gergely Polonkai 4ce4ae4641 Add save_state() and load_state() to Client 2016-03-20 12:39:46 +00:00
Gergely Polonkai 734a8349d0 Add the Client.send() method 2016-03-19 08:12:13 +01:00
Gergely Polonkai 161c171144 Rename API.send_message_event and API.send_room_event
This is to avoid confusion.

* send_message_event became send_event
* send_room_event became send_state_event
2016-03-18 22:07:46 +00:00
Gergely Polonkai b125086669 Fix test-api-client to correctly instantiate the API class 2016-03-18 22:07:36 +00:00
Gergely Polonkai cf53bfa686 Rename Matrix.API.set_user_presence to set_presence
This is to keep consistency
2016-03-18 17:18:28 +01:00
Gergely Polonkai 8d725d9f34 Patch up Matrix.HTTPAPI constructor
It now includes a refresh_token parameter, and has a documentation.
2016-03-18 17:05:18 +01:00
Gergely Polonkai 4db2d5ebf2 Update power levels in Matrix.Room objects when a m.room.power_levels event arrives 2016-03-18 16:58:49 +01:00
Gergely Polonkai 3f7057c652 Move Matrix.Event.RoomPowerLevels internals from HashTable to Gee.HashMap 2016-03-18 16:58:23 +01:00
Gergely Polonkai 00a67705e7 Add user and event level manipulation to Matrix.Room 2016-03-18 16:57:47 +01:00
Gergely Polonkai 3dd3568384 Add per-room profile caching 2016-03-18 11:59:57 +01:00
Gergely Polonkai 15d1896669 Refactor event type checking in HTTP client
Instead of evt.get_type().is_a(typeof(…)) we now use evt is …
2016-03-18 11:59:32 +01:00
Gergely Polonkai 3ddac22f78 Add Client.get_room_by_alias 2016-03-18 11:17:04 +01:00
Gergely Polonkai 0e4a572058 Fix enum value documentations 2016-03-18 09:55:22 +00:00
Gergely Polonkai c8f815c542 Add Client.get_room_by_id() 2016-03-17 17:16:51 +01:00
Gergely Polonkai 9f236de0b9 Fix return value type of Client.get_user_presence() 2016-03-17 17:03:17 +01:00
Gergely Polonkai 3bc8735eb5 Fix message types to always have a body 2016-03-17 17:03:17 +01:00
Gergely Polonkai 5254776d4f Remove possibility of NULL for properties with fundamental types
It is not supported by GObject.
2016-03-17 17:03:17 +01:00
Gergely Polonkai 34b0bea889 Workaround for a missing user_id in m.presence
Despite the Spec, it usually doesn’t have content.user_id, but does have sender
2016-03-17 14:56:22 +01:00
Gergely Polonkai c547e5c080 Protect debug message in Matrix.Event.Receipt 2016-03-17 14:56:22 +01:00
Gergely Polonkai 710c575479 Fix Matrix.Event.RoomCreate
It had a bool? property, which is invalid
2016-03-17 14:56:22 +01:00
Gergely Polonkai ee9e27f8d2 Start caching room data 2016-03-17 10:04:48 +00:00
Gergely Polonkai c9465dc1c0 Move from using Lists to arrays 2016-03-17 10:04:26 +00:00
Gergely Polonkai f6df2200b7 Add Matrix.Room to hold room data 2016-03-16 17:09:30 +00:00
Gergely Polonkai fcc592b072 Fix state and room events
* State event descended from Event, but it is actually based on Room
* Room events may have a missing room_id property due to HS
* optimization
2016-03-16 17:13:05 +01:00
Gergely Polonkai 62eb4e7e21 Add get_user_presence() and get_user_profile() to Client 2016-03-14 23:09:09 +00:00
Gergely Polonkai 04950f8c34 Rename Matrix.API.get_user_presence() to get_presence()
This is for not to clash with future Matrix.Client.get_user_presence()
and to comply with Matrix.API.get_profile() which has similar
functionality.
2016-03-14 23:09:09 +00:00
Gergely Polonkai f1d1eda2e4 Create the Profile object 2016-03-14 23:09:08 +00:00
Gergely Polonkai 595d93412b Add message handler for m.location 2016-03-10 20:03:17 +01:00
Gergely Polonkai 4c9a79758a Add message handler for m.video 2016-03-10 19:47:57 +01:00
Gergely Polonkai 39a4e2f73c Add the VideoInfo struct 2016-03-10 19:46:01 +01:00
Gergely Polonkai 6e5c73c6ad Add message handler for m.audio 2016-03-10 19:30:01 +01:00
Gergely Polonkai 65dffc38da Add the AudioInfo struct 2016-03-10 19:25:09 +01:00
Gergely Polonkai c7d927e6fe Add message handler for m.image 2016-03-10 19:10:12 +01:00
Gergely Polonkai 275a47b5e8 Add message handler for m.file 2016-03-10 19:10:12 +01:00
Gergely Polonkai 78fc89804c Add message handler for m.notice 2016-03-10 19:10:12 +01:00
Gergely Polonkai 51cbda451c Add message handler for m.emote 2016-03-10 19:10:12 +01:00
Gergely Polonkai 1f1bc94bbd Add message handler for m.text 2016-03-10 19:10:12 +01:00
Gergely Polonkai 19323453a9 Add the skeleton of the message type framework 2016-03-10 19:10:10 +01:00
Gergely Polonkai d99cb8b589 Move namespace-info.vala to namespace-info.vala.in
This makes it possible for the .gir file to contain the dynamic API version.
2016-03-10 19:08:33 +01:00
Gergely Polonkai 32245397fd Add the FileInfo struct 2016-03-10 19:07:35 +01:00
Gergely Polonkai 5bb3620395 Refactor ImageInfo
* Add a set_from_json() method
* Start using it in the m.room.avatar handler
2016-03-10 19:07:35 +01:00
Gergely Polonkai 0bcb72d5aa Fix for GObject Introspection generating 2016-03-10 19:07:35 +01:00
Gergely Polonkai f1a58f84b8 Add a .pc file 2016-03-10 19:07:33 +01:00
Gergely Polonkai ddf2165cc2 Patch up Matrix.Event.Base
* Require event_type to be present
2016-03-09 17:34:39 +01:00
Gergely Polonkai a33e3cf6b2 Patch up Matrix.Event.Typing
* Print debug messages when debug is enabled
2016-03-09 16:27:37 +01:00
Gergely Polonkai 4a5aef0a10 Patch up Matrix.Event.RoomTopic
* Require an empty state_key
2016-03-09 16:22:29 +01:00
Gergely Polonkai d714661c17 Patch up Matrix.Event.RoomThirdPartyInvite
* Print debug messages only if debug is enabled
2016-03-09 16:22:29 +01:00
Gergely Polonkai 49a8b1f665 Add value description to HistoryVisibility 2016-03-09 16:22:29 +01:00
Gergely Polonkai feb2bd0323 Patch up Matrix.Event.RoomPowerLevels
* Require an empty state_key
* Make levels int instead of int? with saneish defaults
2016-03-09 16:22:29 +01:00
Gergely Polonkai 75ab5512f1 Patch up Matrix.Event.RoomName
* Require an empty state_key
2016-03-09 16:22:29 +01:00
Gergely Polonkai 9be25a5d61 Remove unused UnsignedEventData class
It is now implemented in Matrix.Event.Room
2016-03-09 16:22:29 +01:00
Gergely Polonkai 4a86522b72 Remove unused _json_object_node_ensure_field
It is now implemented in Matrix.Event.Base
2016-03-09 16:22:29 +01:00
Gergely Polonkai e317df6f01 Patch up Matrix.Event.RoomMember
* Require a non-empty state key
* Throw exception if membership is unknown
2016-03-09 16:22:29 +01:00
Gergely Polonkai 42f1d50877 Patch up Matrix.Event.RoomJoinRules
* Require an empty state key
* Use JoinRules instead of JoinRules?
2016-03-09 16:22:29 +01:00
Gergely Polonkai 7817fb68f6 Patch up Matrix.Event.RoomHistoryVisibility
* Require an empty state_key
2016-03-09 16:22:29 +01:00
Gergely Polonkai 969d9d27ea Patch up Matrix.Event.RoomGuestAccess
* Require an empty state_key
* Use GuestAccess instead of GuestAccess?
2016-03-09 16:22:29 +01:00
Gergely Polonkai 3fe5b57d1c Patch up Matrix.Event.RoomCreate
* Require an empty state key
2016-03-09 16:22:29 +01:00
Gergely Polonkai be2220b079 Patch up Matrix.Event.RoomCanonicalAlias
* Require an empty state key
2016-03-09 16:22:29 +01:00
Gergely Polonkai a68afb1efb Patch up Matrix.Event.RoomAvatar
* Require an empty state key
2016-03-09 16:22:29 +01:00
Gergely Polonkai ddf3fccbaa Patch up Matrix.Event.State
* Use private members
* Make state_key mandatory
2016-03-09 16:22:29 +01:00
Gergely Polonkai a668dc7b98 Patch up Matrix.Event.Presence
* Process the event_id field
* Use private members instead of the public ones
2016-03-09 15:28:18 +01:00
Gergely Polonkai 06daf1757c Patch up Matrix.Event.Typing
* Add from_json() and to_json() methods
2016-03-09 13:54:08 +01:00
Gergely Polonkai 27e27667ef Patch up Matrix.Event.RoomBase
* Chain up from from_json() and to_json()
* Add reading of unsigned data in from_json()
* Use private members in to_json()
2016-03-09 13:44:48 +01:00
Gergely Polonkai c2569c70d0 Patch up Matrix.Event.RoomAliases
* Add a to_json() method
* Chain up in from_json()
2016-03-09 13:37:57 +01:00
Gergely Polonkai a39edfc15a Move Matrix.Event.Receipt._receipt_data to Gee.HashMap 2016-03-09 13:21:14 +01:00
Gergely Polonkai 51c204cc90 Fix Matrix.Event.Receipt
It lacked chaining up in from_json() and the whole to_json() method
2016-03-09 12:02:47 +01:00
Gergely Polonkai ff6400a94a Create a base call for m.call.* events 2016-03-09 11:43:53 +01:00
Gergely Polonkai b9ded01e98 Add to_json() to Matrix.Event.CallInvite 2016-03-09 11:33:44 +01:00
Gergely Polonkai 11de94b822 Add event handler for m.call.hangup 2016-03-09 11:20:18 +01:00
Gergely Polonkai b6b5bbf567 Add event handler for m.call.answer 2016-03-09 10:36:55 +01:00
Gergely Polonkai 399105d961 Add event handler for m.call.candidates 2016-03-09 10:04:44 +01:00
Gergely Polonkai be8910b8be Add event handler for m.call.invite 2016-03-09 08:26:53 +00:00
Gergely Polonkai 1f804e0d42 Add event handler for m.room.third_party_invite 2016-03-09 07:22:54 +00:00
Gergely Polonkai 6db0e82ca7 Make _state_key of Event.State protected
Some state events give a meaning to state_key but having a separate
property is a bit of overkill.
2016-03-09 07:18:21 +00:00
Gergely Polonkai e958e0ecc7 Add event handler for m.room.redaction 2016-03-08 20:49:34 +00:00
Gergely Polonkai 66ae5cff58 Add event handler for m.room.guest_access 2016-03-08 18:18:37 +00:00
Gergely Polonkai 3f7bf44989 Add event handler for m.room.message.feedback 2016-03-08 17:41:34 +01:00
Gergely Polonkai 18bff85653 Add event handler for m.room.avatar 2016-03-08 17:39:24 +01:00
Gergely Polonkai d267b9e110 Add the Matrix.ImageInfo type 2016-03-08 17:09:28 +01:00
Gergely Polonkai ff2530ed2d Fix for m.tag handler
Remove call to deprecated Json.Object.add_member() method
2016-03-08 16:21:35 +01:00
Gergely Polonkai 529fb29155 Add event handler for m.room.power_levels 2016-03-08 16:21:05 +01:00
Gergely Polonkai c8c26a5398 Fix presence event reporting in test client 2016-03-08 14:28:44 +01:00
Gergely Polonkai 39fd66946e Add event handler for m.room.create 2016-03-08 14:13:02 +01:00
Gergely Polonkai bfc5062f90 Add event handler for m.room.canonical_alias 2016-03-08 14:03:38 +01:00
Gergely Polonkai 83d021dfbe Wrap long comment line in enum docs 2016-03-08 12:53:20 +00:00
Gergely Polonkai 69a8dc7954 Add event handler for m.tag 2016-03-08 12:52:42 +00:00
Gergely Polonkai 5c121cef0e Add handler for m.room.name 2016-03-07 22:58:07 +00:00
Gergely Polonkai 82536c650d Add event handler for m.room.join_rules 2016-03-07 18:17:32 +00:00
Gergely Polonkai c581f9e2fb Add event handler for m.room.history_visibility 2016-03-07 17:29:16 +01:00
Gergely Polonkai 13abc13adc Add event handler for m.receipt 2016-03-07 16:38:19 +01:00
Gergely Polonkai 0aaab4af7e Add event handler for m.room.aliases events 2016-03-07 16:38:19 +01:00
Gergely Polonkai f48eaf4c88 Fix Matrix.Event.RoomMember
It now complies with the Matrix spec.
2016-03-07 16:38:19 +01:00
Gergely Polonkai 26d144c593 Add Matrix.Event.State.get_stripped_node()
This returns the full state event if it is allowed to be stripped.
It is needed for m.room.member events.
2016-03-07 16:38:19 +01:00
Gergely Polonkai 3a39c704f1 Add event handler for m.typing 2016-03-07 16:38:19 +01:00
Gergely Polonkai d4ce1cb06c Add handler for m.room.topic events 2016-03-07 16:38:19 +01:00
Gergely Polonkai 70dfaff080 Move Event types to the Matrix.Event namespace 2016-03-07 16:38:19 +01:00
Gergely Polonkai 5f0b877db1 Restructure Matrix.Error value documentation 2016-03-07 16:38:19 +01:00
Gergely Polonkai 97a075d2d2 Fix debug output in HTTPAPI._send() 2016-03-07 09:51:59 +01:00
Gergely Polonkai f37d90e468 Wrap debug messages in Config.DEBUG checks 2016-03-05 07:36:07 +00:00
Gergely Polonkai 95084b8e93 Move internal vapis to a separate directory
Now it's more maintainable and the config constants are made available
2016-03-05 07:35:55 +00:00
Gergely Polonkai e93a7675c0 Move documentation generating to Valadoc
Generating Vala documentation with GTK-Doc is a bit of PITA. Using
Valadoc is much easier, so we are moving there.
2016-03-04 14:52:22 +01:00
Gergely Polonkai 6356ead2b2 Add MatrixClient based test client 2016-03-04 14:35:00 +01:00
Gergely Polonkai 444a93bddf Create the MatrixRoomMessageEvent type
Currently it only handles msgtype and body; more complex types like
documents or images are to be implemented soon.
2016-03-04 14:35:00 +01:00
Gergely Polonkai 2e8343f9bc Fully remove C utility functions 2016-03-04 14:35:00 +01:00
Gergely Polonkai 1bfd8906b6 Redesign MatrixStateEvent as a GObject 2016-03-04 14:35:00 +01:00
Gergely Polonkai ec8f51bced Add search functionality to Matrix API 2016-03-04 14:35:00 +01:00
Gergely Polonkai 50e8d7cd92 Move HTTPClient to the /sync API
The /events API is deprecated according to the Spec.
2016-03-04 14:34:58 +01:00
Gergely Polonkai 1073eecb2f Redesign MatrixPresenceEvent
It is now a MatrixEvent subclass.
2016-03-04 14:23:00 +01:00
Gergely Polonkai 3e6a021a0f Add MatrixRoomMemberEvent 2016-03-04 14:22:59 +01:00
Gergely Polonkai 80d4791658 Add the MatrixRoomMembership enum type 2016-03-04 14:22:27 +01:00
Gergely Polonkai 14031f7faa Add utility function _json_object_node_ensure_field() 2016-03-04 14:22:27 +01:00
Gergely Polonkai 3ba45a1d47 Add MatrixRoomEvent 2016-03-04 14:22:27 +01:00
Gergely Polonkai 6a543fe2c6 Handle all events via MatrixClient::event 2016-03-04 14:22:25 +01:00
Gergely Polonkai d79bb0d9ec Add the MatrixClient::event signal 2016-03-04 14:00:42 +01:00
Gergely Polonkai 0c90d8b00c Create an internal hashtable for event type handlers 2016-03-04 14:00:42 +01:00
Gergely Polonkai 977cfc3f8c Add library constructor function 2016-03-04 14:00:42 +01:00
Gergely Polonkai a3623c55f4 Borrow G_DEFINE_CONSTRUCTOR from GLib 2016-03-04 14:00:42 +01:00
Gergely Polonkai 1e7c54dd45 Define MatrixEvent 2016-03-04 14:00:42 +01:00
Gergely Polonkai 033139672f Add type MatrixUnsignedEventData 2016-03-04 14:00:42 +01:00
Gergely Polonkai 526da5f114 Update Makefile
* .gir file is now generated by Vala
* .vapi now gets installed
2016-03-04 14:00:06 +01:00
Gergely Polonkai 9e7b4f29a8 Add version information functions to the VAPI 2016-03-04 14:00:06 +01:00
Gergely Polonkai 65d2f39dcd Move MatrixError to Vala 2016-03-04 14:00:06 +01:00
Gergely Polonkai a8da282d0b Rework StateEvent in Vala 2016-03-04 14:00:06 +01:00
Gergely Polonkai 6bf5515693 Move the RoomVisibility enum to Vala 2016-03-04 14:00:06 +01:00
Gergely Polonkai ddf4c9de73 Move the RoomPreset enum to Vala 2016-03-04 14:00:06 +01:00
Gergely Polonkai f9542d2f0c Move the ReceiptType enum to Vala 2016-03-04 14:00:06 +01:00
Gergely Polonkai afbaff4a4b Move the PusherKind enum to Vala 2016-03-04 14:00:06 +01:00
Gergely Polonkai e5d110d0f4 Move the PusherConditionKind enum to Vala 2016-03-04 14:00:06 +01:00
Gergely Polonkai 78b98b4a5c Move the Presence enum to Vala 2016-03-04 14:00:06 +01:00
Gergely Polonkai a99ec3ba61 Rework _json_node_deep_copy in Vala 2016-03-04 14:00:06 +01:00
Gergely Polonkai 19ef7de1f0 Rework MatrixPresenceEvent in Vala 2016-03-04 14:00:06 +01:00
Gergely Polonkai 6409b75398 Move the EventDirection enum to Vala 2016-03-04 14:00:06 +01:00
Gergely Polonkai b870802721 Move the AccountKind enum to Vala 2016-03-04 14:00:06 +01:00
Gergely Polonkai f203171443 Move the ResizeMethod enum to Vala 2016-03-04 14:00:06 +01:00
Gergely Polonkai 666dce73ab Rework MatrixPusher in Vala 2016-03-04 14:00:06 +01:00
Gergely Polonkai ecdd3a7dcd Rework Matrix3PidCredential in Vala 2016-03-04 14:00:06 +01:00
Gergely Polonkai 132ea9c426 Rework MatrixFilterRules in Vala 2016-03-04 14:00:06 +01:00
Gergely Polonkai e35cd53d79 Rework MatrixRoomFilter in Vala 2016-03-04 14:00:06 +01:00