40 Commits

Author SHA1 Message Date
Jonas Platte
aa8e00f886
common: Add more useful methods to AnyPushRule, AnyPushRuleRef 2021-04-17 17:44:24 +02:00
Jonas Platte
5d0fb3924e
common: Add PatternedPushRule::applies_to 2021-04-17 17:30:27 +02:00
Jonas Platte
045f610e30
common: Add conversions between AnyPushRule and AnyPushRuleRef 2021-04-17 17:12:32 +02:00
Jonas Platte
ab42d379b8
common: Add borrowing iteration of push rulesets 2021-04-17 16:57:47 +02:00
Jonas Platte
8171e34eac
common: Move AnyPushRule, RulesetIntoIter into separate module 2021-04-17 16:38:08 +02:00
Kévin Commaille
19e849a82a
docs: Document uses of the unstable-pre-spec feature flag 2021-04-12 11:31:01 +02:00
Jonas Platte
444239cc10
common: Use RoomId in PushConditionCtx 2021-04-05 20:42:54 +02:00
Kévin Commaille
cd157885dd
common: Fix push::PushCondition::applies for empty value and pattern 2021-04-03 17:00:04 +02:00
Jonas Platte
171fcfa965
common: Remove redundant clones 2021-03-31 13:11:19 +02:00
Jonas Platte
cd34fba6ad
common: Fix import ordering 2021-03-31 13:11:02 +02:00
Jonas Platte
f91467d0b2
Use maplit::btreemap in tests 2021-03-31 12:32:29 +02:00
Kévin Commaille
038f0eec6d common: Add a function to test an event against PushCondition 2021-03-31 12:12:23 +02:00
Jonas Platte
12686fe6e3
Clean up std::fmt imports
We were pretty inconsistent about them before.
2021-03-25 16:32:08 +01:00
Kévin Commaille
c8c45d10fa common: Replace push rule kinds types with AnyPushRule variants 2021-03-22 20:42:25 +01:00
Kévin Commaille
b79ef0303a Move common::push::AnyPushRule to client_api::r0::push::PushRule 2021-03-22 20:42:25 +01:00
Kévin Commaille
22f7f28e1b common: Replace BTreeSet by IndexSet in push::Ruleset.
Keeps the JSON ordering for priority.

IndexSet are hashed by `rule_id` so its uniqueness is enforced.

A rule can be fetched by its `rule_id`.
2021-03-22 20:42:25 +01:00
Jonas Platte
a20c75d536
Fix import grouping issues 2021-02-25 20:55:19 +01:00
Akshay
adeb545062
Add push rule for .m.rule.reaction 2021-01-21 19:51:32 +01:00
Ana Gelez
483fe8f940 Run cargo fmt 2020-11-27 20:53:51 +01:00
Ana Gelez
0e6d3f17c6 Seal the RulesetMember trait
+ use maplit instead of custom macro
+ fix two little issues in the documentation
2020-11-27 20:52:06 +01:00
Ana Gelez
65ef5f21e5 Use Self constructors when possible 2020-11-27 20:52:06 +01:00
Ana Gelez
1a29875fb4 Rename PushRule to SimplePushRule 2020-11-27 20:52:06 +01:00
Ana Gelez
0e0491c02b Add a "add" method on Ruleset
- Add wrapper types for each kind of push rule
- Add a trait to add a push rule to a rule set
2020-11-27 20:50:10 +01:00
Ana Gelez
e8622ee809 Use a BTreeSet instead of a Vec to make push rule IDs unique
- Introduce a new macro to easily derive Ord, PartialOrd, Eq and PartialEq
  for a PushRule-like type (these traits are required by BTreeSet)
- Introduce a new macro to easily build a BTreeSet
2020-11-27 20:46:58 +01:00
Jonas Platte
e7f55ea2c6
Rewrap comments 2020-11-27 18:22:18 +01:00
Gelez
4c41bfd1f3
Add constructors for default push rules 2020-11-24 22:37:09 +01:00
Jonas Platte
abc18fae39
Fix some links in documentation 2020-11-24 03:25:02 +01:00
Jonas Platte
f2a78babbd
Avoid creating owned strings in deserialization where not necessary 2020-10-26 01:52:51 +01:00
Jonas Platte
e1975c2035
Be more consistent about whitespace 2020-10-24 00:44:01 +02:00
Devin Ragotzy
a3ae741699
Add unstable-exhaustive-types flag to ruma-common 2020-09-03 20:55:11 +02:00
Jonas Platte
1fbf05d71f
Fix some bad formatting 2020-08-08 21:52:58 +02:00
Jonas Platte
1862d15365
Remove glob imports of C-like enums 2020-07-26 17:13:08 +02:00
Jonas Platte
324d339f06
ruma-common: Make most public types non-exhaustive 2020-07-24 20:55:59 +02:00
Jonas Platte
69c8914b03
ruma-common: Small refactorings in any_push_rule.rs
* Make field order consistent
* Use `Self` type alias for shorter code
2020-07-24 20:50:24 +02:00
Jonas Platte
c89905283f
ruma-common: Move AnyPushRule into its own module 2020-07-24 20:40:51 +02:00
Jonas Platte
9f8ceb6286
Update visibility attributes on serde helper types 2020-07-24 20:35:56 +02:00
Jonas Platte
e04ed242fc
Split ruma_common::push into more submodules 2020-07-24 20:15:29 +02:00
Kinrany
99999af08d
Create a dedicated type for PushCondition::RoomMemberCount::is 2020-06-21 21:20:43 +02:00
Jonas Platte
8ddff0d108
Merge rustfmt settings, re-run cargo fmt 2020-06-05 02:01:09 +02:00
Jonas Platte
40b51d73a3 Add 'ruma-common/' from commit 'b516c0cd72c1a5e9985905f60b956c5365cd8789'
git-subtree-dir: ruma-common
git-subtree-mainline: c186f0f8c9c542fd1c7cea464de1ae94e5bd32ba
git-subtree-split: b516c0cd72c1a5e9985905f60b956c5365cd8789
2020-06-05 01:40:05 +02:00