auto-invite-matrix-bot.meta

Issues/PRs archive for MTRNord/auto-invite-matrix-bot
git clone git://archive.git.mtrnord.blog/MTRNord/auto-invite-matrix-bot.meta.git
Log | Files | Refs

1.diff (54301B)


      1 diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
      2 index 312cbfd..3f9c429 100644
      3 --- a/.github/workflows/rust.yml
      4 +++ b/.github/workflows/rust.yml
      5 @@ -11,5 +11,30 @@ jobs:
      6      - uses: actions/checkout@v2
      7      - name: Build
      8        run: cargo build --verbose
      9 -    - name: Run tests
     10 -      run: cargo test --verbose
     11 +
     12 +  clippy:
     13 +
     14 +    runs-on: ubuntu-latest
     15 +
     16 +    steps:
     17 +      - uses: actions/checkout@v2
     18 +      - name: Run Clippy
     19 +        run: cargo clippy --all-targets --all-features -- -D warnings
     20 +
     21 +  fmt:
     22 +
     23 +    runs-on: ubuntu-latest
     24 +
     25 +    steps:
     26 +      - uses: actions/checkout@v2
     27 +      - name: Check cargofmt
     28 +        run: cargo fmt -- --check
     29 +
     30 +  tests:
     31 +
     32 +    runs-on: ubuntu-latest
     33 +
     34 +    steps:
     35 +      - uses: actions/checkout@v2
     36 +      - name: Run tests
     37 +        run: cargo test --verbose
     38 diff --git a/.gitignore b/.gitignore
     39 index 11f5e97..71a6262 100644
     40 --- a/.gitignore
     41 +++ b/.gitignore
     42 @@ -2,3 +2,4 @@
     43  **/*.rs.bk
     44  config.yaml
     45  output.log
     46 +tmp/
     47 diff --git a/Cargo.lock b/Cargo.lock
     48 index f1efc7f..bdecc90 100644
     49 --- a/Cargo.lock
     50 +++ b/Cargo.lock
     51 @@ -13,8 +13,8 @@ name = "atty"
     52  version = "0.2.14"
     53  source = "registry+https://github.com/rust-lang/crates.io-index"
     54  dependencies = [
     55 - "hermit-abi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
     56 - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
     57 + "hermit-abi 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
     58 + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)",
     59   "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
     60  ]
     61  
     62 @@ -24,14 +24,16 @@ version = "0.1.0"
     63  dependencies = [
     64   "chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
     65   "clap 3.0.0-beta.1 (git+https://github.com/clap-rs/clap/)",
     66 + "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
     67   "fern 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
     68   "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
     69   "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
     70   "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
     71 + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
     72   "ruma-client 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
     73   "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
     74   "serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)",
     75 - "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
     76 + "tokio 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
     77   "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
     78  ]
     79  
     80 @@ -40,6 +42,26 @@ name = "autocfg"
     81  version = "1.0.0"
     82  source = "registry+https://github.com/rust-lang/crates.io-index"
     83  
     84 +[[package]]
     85 +name = "backtrace"
     86 +version = "0.3.44"
     87 +source = "registry+https://github.com/rust-lang/crates.io-index"
     88 +dependencies = [
     89 + "backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
     90 + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
     91 + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)",
     92 + "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
     93 +]
     94 +
     95 +[[package]]
     96 +name = "backtrace-sys"
     97 +version = "0.1.32"
     98 +source = "registry+https://github.com/rust-lang/crates.io-index"
     99 +dependencies = [
    100 + "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)",
    101 + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)",
    102 +]
    103 +
    104  [[package]]
    105  name = "bitflags"
    106  version = "1.2.1"
    107 @@ -81,7 +103,7 @@ dependencies = [
    108  [[package]]
    109  name = "clap"
    110  version = "3.0.0-beta.1"
    111 -source = "git+https://github.com/clap-rs/clap/#bbb14f8bd47ef201b315d367922343577ee60718"
    112 +source = "git+https://github.com/clap-rs/clap/#4aaddf837555945f0c9f83e0efa9115fbcc0ac3c"
    113  dependencies = [
    114   "ansi_term 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
    115   "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
    116 @@ -98,13 +120,13 @@ dependencies = [
    117  [[package]]
    118  name = "clap_derive"
    119  version = "3.0.0-beta.1"
    120 -source = "git+https://github.com/clap-rs/clap/#bbb14f8bd47ef201b315d367922343577ee60718"
    121 +source = "git+https://github.com/clap-rs/clap/#4aaddf837555945f0c9f83e0efa9115fbcc0ac3c"
    122  dependencies = [
    123   "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
    124   "proc-macro-error 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
    125 - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
    126 + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
    127   "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
    128 - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
    129 + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
    130  ]
    131  
    132  [[package]]
    133 @@ -113,7 +135,7 @@ version = "0.6.4"
    134  source = "registry+https://github.com/rust-lang/crates.io-index"
    135  dependencies = [
    136   "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
    137 - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
    138 + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)",
    139  ]
    140  
    141  [[package]]
    142 @@ -126,6 +148,26 @@ name = "dtoa"
    143  version = "0.4.5"
    144  source = "registry+https://github.com/rust-lang/crates.io-index"
    145  
    146 +[[package]]
    147 +name = "failure"
    148 +version = "0.1.6"
    149 +source = "registry+https://github.com/rust-lang/crates.io-index"
    150 +dependencies = [
    151 + "backtrace 0.3.44 (registry+https://github.com/rust-lang/crates.io-index)",
    152 + "failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
    153 +]
    154 +
    155 +[[package]]
    156 +name = "failure_derive"
    157 +version = "0.1.6"
    158 +source = "registry+https://github.com/rust-lang/crates.io-index"
    159 +dependencies = [
    160 + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
    161 + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
    162 + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
    163 + "synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
    164 +]
    165 +
    166  [[package]]
    167  name = "fern"
    168  version = "0.5.9"
    169 @@ -186,9 +228,9 @@ version = "0.3.4"
    170  source = "registry+https://github.com/rust-lang/crates.io-index"
    171  dependencies = [
    172   "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)",
    173 - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
    174 + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
    175   "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
    176 - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
    177 + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
    178  ]
    179  
    180  [[package]]
    181 @@ -221,7 +263,7 @@ version = "0.1.14"
    182  source = "registry+https://github.com/rust-lang/crates.io-index"
    183  dependencies = [
    184   "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
    185 - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
    186 + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)",
    187   "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)",
    188  ]
    189  
    190 @@ -239,7 +281,7 @@ dependencies = [
    191   "indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
    192   "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
    193   "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
    194 - "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
    195 + "tokio 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
    196   "tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
    197  ]
    198  
    199 @@ -253,10 +295,10 @@ dependencies = [
    200  
    201  [[package]]
    202  name = "hermit-abi"
    203 -version = "0.1.7"
    204 +version = "0.1.8"
    205  source = "registry+https://github.com/rust-lang/crates.io-index"
    206  dependencies = [
    207 - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
    208 + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)",
    209  ]
    210  
    211  [[package]]
    212 @@ -301,7 +343,7 @@ dependencies = [
    213   "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
    214   "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
    215   "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
    216 - "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
    217 + "tokio 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
    218   "tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
    219   "want 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
    220  ]
    221 @@ -314,7 +356,7 @@ dependencies = [
    222   "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
    223   "hyper 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)",
    224   "native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
    225 - "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
    226 + "tokio 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
    227   "tokio-tls 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
    228  ]
    229  
    230 @@ -341,7 +383,7 @@ name = "iovec"
    231  version = "0.1.4"
    232  source = "registry+https://github.com/rust-lang/crates.io-index"
    233  dependencies = [
    234 - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
    235 + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)",
    236  ]
    237  
    238  [[package]]
    239 @@ -373,7 +415,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
    240  
    241  [[package]]
    242  name = "libc"
    243 -version = "0.2.66"
    244 +version = "0.2.67"
    245  source = "registry+https://github.com/rust-lang/crates.io-index"
    246  
    247  [[package]]
    248 @@ -396,7 +438,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
    249  
    250  [[package]]
    251  name = "memchr"
    252 -version = "2.3.2"
    253 +version = "2.3.3"
    254  source = "registry+https://github.com/rust-lang/crates.io-index"
    255  
    256  [[package]]
    257 @@ -409,7 +451,7 @@ dependencies = [
    258   "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
    259   "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
    260   "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
    261 - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
    262 + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)",
    263   "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
    264   "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
    265   "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
    266 @@ -434,7 +476,7 @@ version = "0.2.3"
    267  source = "registry+https://github.com/rust-lang/crates.io-index"
    268  dependencies = [
    269   "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
    270 - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
    271 + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)",
    272   "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
    273   "openssl 0.10.28 (registry+https://github.com/rust-lang/crates.io-index)",
    274   "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
    275 @@ -451,7 +493,7 @@ version = "0.2.33"
    276  source = "registry+https://github.com/rust-lang/crates.io-index"
    277  dependencies = [
    278   "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
    279 - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
    280 + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)",
    281   "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
    282  ]
    283  
    284 @@ -481,7 +523,7 @@ dependencies = [
    285   "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
    286   "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
    287   "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
    288 - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
    289 + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)",
    290   "openssl-sys 0.9.54 (registry+https://github.com/rust-lang/crates.io-index)",
    291  ]
    292  
    293 @@ -497,7 +539,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
    294  dependencies = [
    295   "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
    296   "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)",
    297 - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
    298 + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)",
    299   "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
    300   "vcpkg 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
    301  ]
    302 @@ -520,9 +562,9 @@ name = "pin-project-internal"
    303  version = "0.4.8"
    304  source = "registry+https://github.com/rust-lang/crates.io-index"
    305  dependencies = [
    306 - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
    307 + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
    308   "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
    309 - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
    310 + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
    311  ]
    312  
    313  [[package]]
    314 @@ -551,10 +593,10 @@ version = "0.4.9"
    315  source = "registry+https://github.com/rust-lang/crates.io-index"
    316  dependencies = [
    317   "proc-macro-error-attr 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
    318 - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
    319 + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
    320   "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
    321   "rustversion 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
    322 - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
    323 + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
    324  ]
    325  
    326  [[package]]
    327 @@ -562,10 +604,10 @@ name = "proc-macro-error-attr"
    328  version = "0.4.9"
    329  source = "registry+https://github.com/rust-lang/crates.io-index"
    330  dependencies = [
    331 - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
    332 + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
    333   "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
    334   "rustversion 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
    335 - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
    336 + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
    337   "syn-mid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
    338  ]
    339  
    340 @@ -574,9 +616,9 @@ name = "proc-macro-hack"
    341  version = "0.5.11"
    342  source = "registry+https://github.com/rust-lang/crates.io-index"
    343  dependencies = [
    344 - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
    345 + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
    346   "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
    347 - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
    348 + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
    349  ]
    350  
    351  [[package]]
    352 @@ -586,7 +628,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
    353  
    354  [[package]]
    355  name = "proc-macro2"
    356 -version = "1.0.8"
    357 +version = "1.0.9"
    358  source = "registry+https://github.com/rust-lang/crates.io-index"
    359  dependencies = [
    360   "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
    361 @@ -597,7 +639,7 @@ name = "quote"
    362  version = "1.0.2"
    363  source = "registry+https://github.com/rust-lang/crates.io-index"
    364  dependencies = [
    365 - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
    366 + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
    367  ]
    368  
    369  [[package]]
    370 @@ -606,7 +648,7 @@ version = "0.7.3"
    371  source = "registry+https://github.com/rust-lang/crates.io-index"
    372  dependencies = [
    373   "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
    374 - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
    375 + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)",
    376   "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
    377   "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
    378   "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
    379 @@ -670,9 +712,9 @@ name = "ruma-api-macros"
    380  version = "0.10.1"
    381  source = "registry+https://github.com/rust-lang/crates.io-index"
    382  dependencies = [
    383 - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
    384 + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
    385   "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
    386 - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
    387 + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
    388  ]
    389  
    390  [[package]]
    391 @@ -687,7 +729,7 @@ dependencies = [
    392   "hyper-tls 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
    393   "ruma-api 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
    394   "ruma-client-api 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
    395 - "ruma-events 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
    396 + "ruma-events 0.15.1 (git+https://github.com/MTRNord/ruma-events.git?branch=relates_to_backport)",
    397   "ruma-identifiers 0.14.1 (git+https://github.com/ruma/ruma-identifiers.git)",
    398   "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
    399   "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)",
    400 @@ -702,7 +744,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
    401  dependencies = [
    402   "js_int 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
    403   "ruma-api 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
    404 - "ruma-events 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
    405 + "ruma-events 0.15.1 (git+https://github.com/MTRNord/ruma-events.git?branch=relates_to_backport)",
    406   "ruma-identifiers 0.14.1 (git+https://github.com/ruma/ruma-identifiers.git)",
    407   "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
    408   "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)",
    409 @@ -712,10 +754,10 @@ dependencies = [
    410  [[package]]
    411  name = "ruma-events"
    412  version = "0.15.1"
    413 -source = "registry+https://github.com/rust-lang/crates.io-index"
    414 +source = "git+https://github.com/MTRNord/ruma-events.git?branch=relates_to_backport#4331dc1f5b831f1db6a88f678379e6c8ba6865f7"
    415  dependencies = [
    416   "js_int 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
    417 - "ruma-events-macros 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
    418 + "ruma-events-macros 0.2.0 (git+https://github.com/MTRNord/ruma-events.git?branch=relates_to_backport)",
    419   "ruma-identifiers 0.14.1 (git+https://github.com/ruma/ruma-identifiers.git)",
    420   "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
    421   "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)",
    422 @@ -724,11 +766,11 @@ dependencies = [
    423  [[package]]
    424  name = "ruma-events-macros"
    425  version = "0.2.0"
    426 -source = "registry+https://github.com/rust-lang/crates.io-index"
    427 +source = "git+https://github.com/MTRNord/ruma-events.git?branch=relates_to_backport#4331dc1f5b831f1db6a88f678379e6c8ba6865f7"
    428  dependencies = [
    429 - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
    430 + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
    431   "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
    432 - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
    433 + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
    434  ]
    435  
    436  [[package]]
    437 @@ -741,14 +783,19 @@ dependencies = [
    438   "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
    439  ]
    440  
    441 +[[package]]
    442 +name = "rustc-demangle"
    443 +version = "0.1.16"
    444 +source = "registry+https://github.com/rust-lang/crates.io-index"
    445 +
    446  [[package]]
    447  name = "rustversion"
    448  version = "1.0.2"
    449  source = "registry+https://github.com/rust-lang/crates.io-index"
    450  dependencies = [
    451 - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
    452 + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
    453   "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
    454 - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
    455 + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
    456  ]
    457  
    458  [[package]]
    459 @@ -772,7 +819,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
    460  dependencies = [
    461   "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
    462   "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
    463 - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
    464 + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)",
    465   "security-framework-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
    466  ]
    467  
    468 @@ -797,9 +844,9 @@ name = "serde_derive"
    469  version = "1.0.104"
    470  source = "registry+https://github.com/rust-lang/crates.io-index"
    471  dependencies = [
    472 - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
    473 + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
    474   "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
    475 - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
    476 + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
    477  ]
    478  
    479  [[package]]
    480 @@ -851,10 +898,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
    481  
    482  [[package]]
    483  name = "syn"
    484 -version = "1.0.14"
    485 +version = "1.0.16"
    486  source = "registry+https://github.com/rust-lang/crates.io-index"
    487  dependencies = [
    488 - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
    489 + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
    490   "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
    491   "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
    492  ]
    493 @@ -864,9 +911,20 @@ name = "syn-mid"
    494  version = "0.5.0"
    495  source = "registry+https://github.com/rust-lang/crates.io-index"
    496  dependencies = [
    497 - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
    498 + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
    499   "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
    500 - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
    501 + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
    502 +]
    503 +
    504 +[[package]]
    505 +name = "synstructure"
    506 +version = "0.12.3"
    507 +source = "registry+https://github.com/rust-lang/crates.io-index"
    508 +dependencies = [
    509 + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
    510 + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
    511 + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
    512 + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
    513  ]
    514  
    515  [[package]]
    516 @@ -875,7 +933,7 @@ version = "3.1.0"
    517  source = "registry+https://github.com/rust-lang/crates.io-index"
    518  dependencies = [
    519   "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
    520 - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
    521 + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)",
    522   "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
    523   "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
    524   "remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
    525 @@ -895,35 +953,35 @@ name = "time"
    526  version = "0.1.42"
    527  source = "registry+https://github.com/rust-lang/crates.io-index"
    528  dependencies = [
    529 - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
    530 + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)",
    531   "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
    532   "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
    533  ]
    534  
    535  [[package]]
    536  name = "tokio"
    537 -version = "0.2.11"
    538 +version = "0.2.12"
    539  source = "registry+https://github.com/rust-lang/crates.io-index"
    540  dependencies = [
    541   "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
    542   "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
    543   "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
    544   "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
    545 - "memchr 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
    546 + "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
    547   "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)",
    548   "pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
    549   "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
    550 - "tokio-macros 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
    551 + "tokio-macros 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
    552  ]
    553  
    554  [[package]]
    555  name = "tokio-macros"
    556 -version = "0.2.4"
    557 +version = "0.2.5"
    558  source = "registry+https://github.com/rust-lang/crates.io-index"
    559  dependencies = [
    560 - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
    561 + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
    562   "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
    563 - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
    564 + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
    565  ]
    566  
    567  [[package]]
    568 @@ -932,7 +990,7 @@ version = "0.3.0"
    569  source = "registry+https://github.com/rust-lang/crates.io-index"
    570  dependencies = [
    571   "native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
    572 - "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
    573 + "tokio 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
    574  ]
    575  
    576  [[package]]
    577 @@ -945,7 +1003,7 @@ dependencies = [
    578   "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
    579   "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
    580   "pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
    581 - "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
    582 + "tokio 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
    583  ]
    584  
    585  [[package]]
    586 @@ -1074,6 +1132,8 @@ dependencies = [
    587  "checksum ansi_term 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
    588  "checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
    589  "checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
    590 +"checksum backtrace 0.3.44 (registry+https://github.com/rust-lang/crates.io-index)" = "e4036b9bf40f3cf16aba72a3d65e8a520fc4bafcdc7079aea8f848c58c5b5536"
    591 +"checksum backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6575f128516de27e3ce99689419835fce9643a9b215a14d2b5b685be018491"
    592  "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
    593  "checksum bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1"
    594  "checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb"
    595 @@ -1085,6 +1145,8 @@ dependencies = [
    596  "checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d"
    597  "checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b"
    598  "checksum dtoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "4358a9e11b9a09cf52383b451b49a169e8d797b68aa02301ff586d70d9661ea3"
    599 +"checksum failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9"
    600 +"checksum failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08"
    601  "checksum fern 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e69ab0d5aca163e388c3a49d284fed6c3d0810700e77c5ae2756a50ec1a4daaa"
    602  "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
    603  "checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
    604 @@ -1100,7 +1162,7 @@ dependencies = [
    605  "checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
    606  "checksum h2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b9433d71e471c1736fd5a61b671fc0b148d7a2992f666c958d03cd8feb3b88d1"
    607  "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
    608 -"checksum hermit-abi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "e2c55f143919fbc0bc77e427fe2d74cf23786d7c1875666f2fde3ac3c659bb67"
    609 +"checksum hermit-abi 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1010591b26bbfe835e9faeabeb11866061cc7dcebffd56ad7d0942d0e61aefd8"
    610  "checksum http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b708cc7f06493459026f53b9a61a7a121a5d1ec6238dee58ea4941132b30156b"
    611  "checksum http-body 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b"
    612  "checksum httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9"
    613 @@ -1113,11 +1175,11 @@ dependencies = [
    614  "checksum js_int 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7a28645cf69403534c8b3c961783cdc227c4c4fa5d31468464de1f43be0efcfc"
    615  "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
    616  "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
    617 -"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
    618 +"checksum libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)" = "eb147597cdf94ed43ab7a9038716637d2d1bf2bc571da995d0028dec06bd3018"
    619  "checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83"
    620  "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
    621  "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
    622 -"checksum memchr 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53445de381a1f436797497c61d851644d0e8e88e6140f22872ad33a704933978"
    623 +"checksum memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
    624  "checksum mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)" = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f"
    625  "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
    626  "checksum native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b2df1a4c22fd44a62147fd8f13dd0f95c9d8ca7b2610299b2a2f9cf8964274e"
    627 @@ -1138,7 +1200,7 @@ dependencies = [
    628  "checksum proc-macro-error-attr 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "d175bef481c7902e63e3165627123fff3502f06ac043d3ef42d08c1246da9253"
    629  "checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5"
    630  "checksum proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e"
    631 -"checksum proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3acb317c6ff86a4e579dfa00fc5e6cca91ecbb4e7eb2df0468805b674eb88548"
    632 +"checksum proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435"
    633  "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
    634  "checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
    635  "checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853"
    636 @@ -1150,9 +1212,10 @@ dependencies = [
    637  "checksum ruma-api-macros 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e2c60086b570af5d8b88c9e2f10b3c4c950436658a104c3e60117eca2b1c466"
    638  "checksum ruma-client 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b9e333757b70f7c8e289191e9db1e5db21d56495507dd9aaeadcdbedded55418"
    639  "checksum ruma-client-api 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa35e24b165401c1066416d804d830313f27d934dcd71f4388396a42f98ba020"
    640 -"checksum ruma-events 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4a196cbeaa7bffe3756448ee9cf142645790e2a0ece78dfaf10a311eaf5e2a5e"
    641 -"checksum ruma-events-macros 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "962d93056619ed61826a9d8872c863560e4892ff6a69b70f593baa5ae8b19dc8"
    642 +"checksum ruma-events 0.15.1 (git+https://github.com/MTRNord/ruma-events.git?branch=relates_to_backport)" = "<none>"
    643 +"checksum ruma-events-macros 0.2.0 (git+https://github.com/MTRNord/ruma-events.git?branch=relates_to_backport)" = "<none>"
    644  "checksum ruma-identifiers 0.14.1 (git+https://github.com/ruma/ruma-identifiers.git)" = "<none>"
    645 +"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
    646  "checksum rustversion 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b3bba175698996010c4f6dce5e7f173b6eb781fce25d2cfc45e27091ce0b79f6"
    647  "checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8"
    648  "checksum schannel 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "507a9e6e8ffe0a4e0ebb9a10293e62fdf7657c06f1b8bb07a8fcf697d2abf295"
    649 @@ -1166,13 +1229,14 @@ dependencies = [
    650  "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
    651  "checksum smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc"
    652  "checksum strsim 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c"
    653 -"checksum syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "af6f3550d8dff9ef7dc34d384ac6f107e5d31c8f57d9f28e0081503f547ac8f5"
    654 +"checksum syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)" = "123bd9499cfb380418d509322d7a6d52e5315f064fe4b3ad18a53d6b92c07859"
    655  "checksum syn-mid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a"
    656 +"checksum synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545"
    657  "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
    658  "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
    659  "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
    660 -"checksum tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8fdd17989496f49cdc57978c96f0c9fe5e4a58a8bddc6813c449a4624f6a030b"
    661 -"checksum tokio-macros 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f4b1e7ed7d5d4c2af3d999904b0eebe76544897cdbfb2b9684bed2174ab20f7c"
    662 +"checksum tokio 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "b34bee1facdc352fba10c9c58b654e6ecb6a2250167772bf86071f7c5f2f5061"
    663 +"checksum tokio-macros 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389"
    664  "checksum tokio-tls 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7bde02a3a5291395f59b06ec6945a3077602fac2b07eeeaf0dee2122f3619828"
    665  "checksum tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930"
    666  "checksum tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860"
    667 diff --git a/Cargo.toml b/Cargo.toml
    668 index 4c3f0ba..8d910d5 100644
    669 --- a/Cargo.toml
    670 +++ b/Cargo.toml
    671 @@ -18,7 +18,9 @@ serde_yaml = "0.8"
    672  log = "0.4.8"
    673  fern = "0.5"
    674  chrono = "0.4.10"
    675 -
    676 +rand = "0.7.3"
    677 +failure = "0.1.6"
    678  
    679  [patch.crates-io]
    680  ruma-identifiers = { git = 'https://github.com/ruma/ruma-identifiers.git' }
    681 +ruma-events = { git = 'https://github.com/MTRNord/ruma-events.git', branch = "relates_to_backport" }
    682 diff --git a/config_example.yml b/config_example.yml
    683 index ffe4130..dde4f39 100644
    684 --- a/config_example.yml
    685 +++ b/config_example.yml
    686 @@ -1,6 +1,7 @@
    687  ---
    688  message: "This is an automated message. You seem to have invited one of my other Matrix Accounts. A Bot has now invited the correct user. Please be patient until I respond!"
    689  target_user: "@MTRNord:matrix.ffslfl.net"
    690 +debug: true
    691  servers:
    692    - address: "https://mozilla.modular.im"
    693      mxid: "@mtrnord:mozilla.org"
    694 diff --git a/src/config.rs b/src/config.rs
    695 index 58177da..43c192c 100644
    696 --- a/src/config.rs
    697 +++ b/src/config.rs
    698 @@ -8,6 +8,7 @@ pub struct Config {
    699      pub message: String,
    700      pub target_user: String,
    701      pub servers: Vec<Homeserver>,
    702 +    pub debug: bool,
    703  }
    704  
    705  #[derive(Debug, PartialEq, Serialize, Deserialize)]
    706 diff --git a/src/main.rs b/src/main.rs
    707 index 0453a86..199750a 100644
    708 --- a/src/main.rs
    709 +++ b/src/main.rs
    710 @@ -1,8 +1,14 @@
    711  use std::convert::TryFrom;
    712 +use std::fs;
    713 +use std::fs::File;
    714 +use std::io::{BufReader, BufWriter, Read, Write};
    715  
    716  use clap::Clap;
    717 -use futures_util::future::join_all;
    718 +use futures_util::stream::FuturesUnordered;
    719  use futures_util::stream::TryStreamExt as _;
    720 +use log::{debug, error, info, warn};
    721 +use rand::distributions::Alphanumeric;
    722 +use rand::{thread_rng, Rng};
    723  use ruma_client::api::r0::membership::invite_user;
    724  use ruma_client::api::r0::membership::join_room_by_id;
    725  use ruma_client::api::r0::message::create_message_event;
    726 @@ -10,23 +16,130 @@ use ruma_client::api::r0::sync::sync_events::IncomingResponse;
    727  use ruma_client::identifiers::UserId;
    728  use ruma_client::{
    729      self,
    730 +    api::r0::{
    731 +        filter::{FilterDefinition, RoomEventFilter, RoomFilter},
    732 +        message::create_message_event::Response,
    733 +        room::create_room,
    734 +        sync::sync_events::Filter,
    735 +    },
    736      events::{
    737 -        room::message::{MessageEventContent, NoticeMessageEventContent},
    738 +        collections::all::RoomEvent::{self, RoomMessage},
    739 +        room::message::{
    740 +            InReplyTo, MessageEvent,
    741 +            MessageEventContent::{self, Text},
    742 +            NoticeMessageEventContent, RelatesTo, TextMessageEventContent,
    743 +        },
    744          EventType,
    745      },
    746 +    identifiers::{EventId, RoomId},
    747      HttpsClient, Session,
    748  };
    749  use url::Url;
    750  
    751 -use log::{debug, error, info};
    752 -
    753  use crate::config::{load_config, Config, Homeserver};
    754  use crate::logger::setup_logger;
    755  
    756  mod config;
    757  mod logger;
    758  
    759 -async fn do_stuff(config: &Config, server: &Homeserver) -> Result<(), ruma_client::Error> {
    760 +async fn send_notice_reply(
    761 +    client: &HttpsClient,
    762 +    text: String,
    763 +    related_event: EventId,
    764 +    room_id: RoomId,
    765 +) -> Result<Response, ruma_client::Error> {
    766 +    let rand_string: String = thread_rng().sample_iter(&Alphanumeric).take(30).collect();
    767 +    client
    768 +        .request(create_message_event::Request {
    769 +            room_id,
    770 +            event_type: EventType::RoomMessage,
    771 +            txn_id: rand_string,
    772 +            data: MessageEventContent::Notice(NoticeMessageEventContent {
    773 +                body: text,
    774 +                relates_to: Some(RelatesTo {
    775 +                    in_reply_to: InReplyTo {
    776 +                        event_id: related_event,
    777 +                    },
    778 +                }),
    779 +            }),
    780 +        })
    781 +        .await
    782 +}
    783 +
    784 +async fn send_message(
    785 +    client: &HttpsClient,
    786 +    text: String,
    787 +    room_id: RoomId,
    788 +) -> Result<Response, ruma_client::Error> {
    789 +    let rand_string: String = thread_rng().sample_iter(&Alphanumeric).take(30).collect();
    790 +    client
    791 +        .request(create_message_event::Request {
    792 +            room_id,
    793 +            event_type: EventType::RoomMessage,
    794 +            txn_id: rand_string,
    795 +            data: MessageEventContent::Text(TextMessageEventContent {
    796 +                body: text,
    797 +                format: None,
    798 +                formatted_body: None,
    799 +                relates_to: None,
    800 +            }),
    801 +        })
    802 +        .await
    803 +}
    804 +
    805 +async fn get_control_room(
    806 +    client: &HttpsClient,
    807 +    target_user: String,
    808 +) -> Result<RoomId, failure::Error> {
    809 +    fs::create_dir_all("./tmp/")?;
    810 +    let mut room_id_read = String::new();
    811 +    match File::open(format!(
    812 +        "./tmp/control_room_{}",
    813 +        client.session().unwrap().user_id.hostname()
    814 +    )) {
    815 +        Ok(f) => {
    816 +            let mut br = BufReader::new(f);
    817 +            match br.read_to_string(&mut room_id_read) {
    818 +                Ok(_) => {
    819 +                    let room_id = RoomId::try_from(room_id_read.as_str()).unwrap();
    820 +                    Ok(room_id)
    821 +                }
    822 +                Err(e) => Err(failure::Error::try_from(e)?),
    823 +            }
    824 +        }
    825 +        Err(e) => {
    826 +            warn!("Unable to open control_room_tmp: {}", e);
    827 +            let resp = client
    828 +                .request(create_room::Request {
    829 +                    invite: vec![UserId::try_from(target_user.as_str())?],
    830 +                    name: Some(format!(
    831 +                        "AutoInviteBot Control Room {}",
    832 +                        client.session().unwrap().user_id.hostname()
    833 +                    )),
    834 +                    preset: Some(create_room::RoomPreset::TrustedPrivateChat),
    835 +                    creation_content: None,
    836 +                    room_alias_name: None,
    837 +                    topic: None,
    838 +                    visibility: None,
    839 +                })
    840 +                .await?;
    841 +            let room_id: RoomId = resp.room_id;
    842 +            let f = File::create(format!(
    843 +                "./tmp/control_room_{}",
    844 +                client.session().unwrap().user_id.hostname()
    845 +            ))?;
    846 +            let mut f = BufWriter::new(f);
    847 +            f.write_all(room_id.to_string().as_bytes())?;
    848 +
    849 +            Ok(room_id)
    850 +        }
    851 +    }
    852 +}
    853 +
    854 +async fn get_client(
    855 +    server: &Homeserver,
    856 +    target_user: String,
    857 +) -> Result<(HttpsClient, RoomId), failure::Error> {
    858      info!("Starting session as {}", server.mxid);
    859  
    860      let session: Session;
    861 @@ -66,41 +179,256 @@ async fn do_stuff(config: &Config, server: &Homeserver) -> Result<(), ruma_clien
    862          error!("Please provide either a password or an access_token!");
    863      }
    864  
    865 -    let mut sync_stream = Box::pin(client.sync(None, None, false));
    866 -    let message = config.message.clone();
    867 +    let control_room_id = get_control_room(&client, target_user).await?;
    868 +
    869 +    info!("Started session as {}", server.mxid);
    870 +
    871 +    Ok((client, control_room_id))
    872 +}
    873 +
    874 +async fn parse_invites(
    875 +    client: &HttpsClient,
    876 +    room_id: RoomId,
    877 +    target_user: String,
    878 +    message: String,
    879 +) -> Result<(), ruma_client::Error> {
    880 +    // Auto join rooms
    881 +    debug!("Invited to {:?}", room_id);
    882 +    client
    883 +        .request(join_room_by_id::Request {
    884 +            room_id: room_id.clone(),
    885 +            third_party_signed: None,
    886 +        })
    887 +        .await?;
    888 +    debug!("Joined {:?}", room_id.clone());
    889 +    let response = client
    890 +        .request(invite_user::Request {
    891 +            room_id: room_id.clone(),
    892 +            user_id: UserId::try_from(target_user.as_str()).unwrap(),
    893 +        })
    894 +        .await?;
    895 +    debug!("Invited correct user {:?}", response);
    896 +
    897 +    let rand_string: String = thread_rng().sample_iter(&Alphanumeric).take(30).collect();
    898 +    client
    899 +        .request(create_message_event::Request {
    900 +            room_id: room_id.clone(),
    901 +            event_type: EventType::RoomMessage,
    902 +            txn_id: rand_string,
    903 +            data: MessageEventContent::Notice(NoticeMessageEventContent {
    904 +                body: message,
    905 +                relates_to: None,
    906 +            }),
    907 +        })
    908 +        .await?;
    909 +
    910 +    debug!("Sent a message about what happened");
    911 +    Ok(())
    912 +}
    913 +
    914 +async fn handle_mention(
    915 +    client: &HttpsClient,
    916 +    config: &Config,
    917 +    control_room_id: RoomId,
    918 +    room_id: RoomId,
    919 +    sender: UserId,
    920 +    event_id: EventId,
    921 +    body: String,
    922 +) -> Result<(), failure::Error> {
    923 +    if config.debug {
    924 +        send_notice_reply(
    925 +            &client,
    926 +            format!(
    927 +                "> <{}> {}\n\n[DEBUG] Mentioned main account about this mention",
    928 +                sender, body
    929 +            ),
    930 +            event_id.clone(),
    931 +            room_id.clone(),
    932 +        )
    933 +        .await?;
    934 +    }
    935 +
    936 +    // Send mention to control room
    937 +    send_message(
    938 +        &client,
    939 +        format!(
    940 +            "> <{}> {}\n\n Mention in {} by {}",
    941 +            sender, body, room_id, sender
    942 +        ),
    943 +        control_room_id.clone(),
    944 +    )
    945 +    .await?;
    946 +
    947 +    Ok(())
    948 +}
    949 +
    950 +async fn parse_joins(
    951 +    client: &HttpsClient,
    952 +    config: &Config,
    953 +    server: &Homeserver,
    954 +    event: RoomEvent,
    955 +    room_id: RoomId,
    956 +    control_room_id: RoomId,
    957 +) -> Result<(), failure::Error> {
    958 +    if let RoomMessage(msg) = event {
    959 +        let content = msg.content;
    960 +        let event_id = msg.event_id;
    961 +        let sender = msg.sender;
    962 +        if let Text(msg_content) = content {
    963 +            let formatted_body: Option<String> = msg_content.formatted_body;
    964 +            let body: String = msg_content.body;
    965 +
    966 +            if sender.to_string() != client.session().unwrap().user_id.to_string()
    967 +                && formatted_body.clone().is_some()
    968 +                && formatted_body
    969 +                    .clone()
    970 +                    .unwrap()
    971 +                    .to_lowercase()
    972 +                    .contains(&server.mxid.clone().to_lowercase())
    973 +            {
    974 +                handle_mention(
    975 +                    client,
    976 +                    config,
    977 +                    control_room_id.clone(),
    978 +                    room_id.clone(),
    979 +                    sender.clone(),
    980 +                    event_id.clone(),
    981 +                    body.clone(),
    982 +                )
    983 +                .await?;
    984 +            } else if sender.to_string() != client.session().unwrap().user_id.to_string()
    985 +                && formatted_body.clone().is_none()
    986 +                && body.to_lowercase().contains(
    987 +                    server
    988 +                        .mxid
    989 +                        .clone()
    990 +                        .to_lowercase()
    991 +                        .split(':')
    992 +                        .collect::<Vec<_>>()[0],
    993 +                )
    994 +            {
    995 +                handle_mention(
    996 +                    client,
    997 +                    config,
    998 +                    control_room_id.clone(),
    999 +                    room_id.clone(),
   1000 +                    sender.clone(),
   1001 +                    event_id.clone(),
   1002 +                    body.clone(),
   1003 +                )
   1004 +                .await?;
   1005 +            }
   1006 +            // Todo make a smarter command handler
   1007 +            /*if body.starts_with("!test") {
   1008 +                send_notice_reply(
   1009 +                    &client,
   1010 +                    format!("> <{}> {}\n\ntest resp", sender, body),
   1011 +                    event_id.clone(),
   1012 +                    room_id.clone(),
   1013 +                )
   1014 +                .await?;
   1015 +            }*/
   1016 +        }
   1017 +    }
   1018 +    Ok(())
   1019 +}
   1020 +
   1021 +async fn load_next_batch() -> Result<String, failure::Error> {
   1022 +    fs::create_dir_all("./tmp/")?;
   1023 +    let mut next_batch = String::new();
   1024 +    let f = File::open("./tmp/next_batch")?;
   1025 +    let mut br = BufReader::new(f);
   1026 +    br.read_to_string(&mut next_batch)?;
   1027 +    Ok(next_batch)
   1028 +}
   1029 +
   1030 +async fn save_next_batch(next_batch: String) -> Result<(), failure::Error> {
   1031 +    let f = File::create("./tmp/next_batch")?;
   1032 +    let mut f = BufWriter::new(f);
   1033 +    f.write_all(next_batch.as_bytes())?;
   1034 +    Ok(())
   1035 +}
   1036 +
   1037 +fn generate_filter() -> Result<Filter, failure::Error> {
   1038 +    let filter = FilterDefinition {
   1039 +        event_fields: None,
   1040 +        event_format: None,
   1041 +        account_data: None,
   1042 +        room: Some(RoomFilter {
   1043 +            include_leave: None,
   1044 +            account_data: None,
   1045 +            timeline: Some(RoomEventFilter {
   1046 +                not_types: vec![],
   1047 +                not_rooms: vec![],
   1048 +                limit: None,
   1049 +                rooms: None,
   1050 +                not_senders: vec![],
   1051 +                senders: None,
   1052 +                types: Some(vec!["m.room.message".to_owned()]),
   1053 +                contains_url: None,
   1054 +            }),
   1055 +            ephemeral: None,
   1056 +            state: None,
   1057 +            not_rooms: vec![],
   1058 +            rooms: None,
   1059 +        }),
   1060 +        presence: None,
   1061 +    };
   1062 +    Ok(Filter::FilterDefinition(filter))
   1063 +}
   1064 +
   1065 +async fn do_stuff(config: &Config, server: &Homeserver) -> Result<(), failure::Error> {
   1066      let target_user = config.target_user.clone();
   1067 +    let (client, control_room_id) = get_client(server, target_user.clone()).await?;
   1068 +
   1069 +    let since = match load_next_batch().await {
   1070 +        Ok(v) => Some(v),
   1071 +        Err(e) => {
   1072 +            error!("{:?}", e);
   1073 +            None
   1074 +        }
   1075 +    };
   1076 +
   1077 +    let filter = match generate_filter() {
   1078 +        Ok(v) => Some(v),
   1079 +        Err(e) => {
   1080 +            error!("{:?}", e);
   1081 +            None
   1082 +        }
   1083 +    };
   1084 +
   1085 +    let mut sync_stream = Box::pin(client.sync(filter, since, false));
   1086 +    let message = config.message.clone();
   1087      while let Some(response) = sync_stream.try_next().await? {
   1088          let res: IncomingResponse = response;
   1089 +        let next_batch: String = res.next_batch;
   1090 +        save_next_batch(next_batch).await?;
   1091 +
   1092          for (room_id, _room) in res.rooms.invite {
   1093 -            // Auto join rooms
   1094 -            debug!("Invited to {:?}", room_id.clone());
   1095 -            client
   1096 -                .request(join_room_by_id::Request {
   1097 -                    room_id: room_id.clone(),
   1098 -                    third_party_signed: None,
   1099 -                })
   1100 -                .await?;
   1101 -            debug!("Joined {:?}", room_id.clone());
   1102 -            let response = client
   1103 -                .request(invite_user::Request {
   1104 -                    room_id: room_id.clone(),
   1105 -                    user_id: UserId::try_from(target_user.clone().as_str()).unwrap(),
   1106 -                })
   1107 -                .await?;
   1108 -            debug!("Invited correct user {:?}", response);
   1109 -            client
   1110 -                .request(create_message_event::Request {
   1111 -                    room_id,
   1112 -                    event_type: EventType::RoomMessage,
   1113 -                    txn_id: "1".to_owned(),
   1114 -                    data: MessageEventContent::Notice(NoticeMessageEventContent {
   1115 -                        body: message.clone(),
   1116 -                        relates_to: None,
   1117 -                    }),
   1118 -                })
   1119 -                .await?;
   1120 +            parse_invites(
   1121 +                &client,
   1122 +                room_id.clone(),
   1123 +                target_user.clone(),
   1124 +                message.clone(),
   1125 +            )
   1126 +            .await?;
   1127 +        }
   1128 +        for (room_id, room) in res.rooms.join {
   1129 +            let events = room.timeline.events;
   1130  
   1131 -            debug!("Sent a message about what happened");
   1132 +            for event in events.into_iter().flat_map(|r| r.into_result()) {
   1133 +                if let RoomEvent::RoomMessage(MessageEvent { .. }) = event {
   1134 +                    parse_joins(
   1135 +                        &client,
   1136 +                        config,
   1137 +                        server,
   1138 +                        event.clone(),
   1139 +                        room_id.clone(),
   1140 +                        control_room_id.clone(),
   1141 +                    )
   1142 +                    .await?;
   1143 +                }
   1144 +            }
   1145          }
   1146      }
   1147  
   1148 @@ -118,7 +446,7 @@ struct Opts {
   1149  }
   1150  
   1151  #[tokio::main]
   1152 -async fn main() -> Result<(), ruma_client::Error> {
   1153 +async fn main() -> Result<(), failure::Error> {
   1154      let opts: Opts = Opts::parse();
   1155  
   1156      let log_level = match opts.verbose {
   1157 @@ -132,12 +460,16 @@ async fn main() -> Result<(), ruma_client::Error> {
   1158      setup_logger(log_level).expect("unable to setup logger");
   1159  
   1160      let config = load_config(opts.config).expect("unable to read config");
   1161 -    let mut futures = vec![];
   1162 +
   1163 +    let mut futures = FuturesUnordered::new();
   1164  
   1165      config.servers.iter().for_each(|x| {
   1166          futures.push(do_stuff(&config, x));
   1167      });
   1168  
   1169 -    join_all(futures).await;
   1170 +    while let Some(x) = futures.try_next().await? {
   1171 +        error!("{:?}", x);
   1172 +    }
   1173 +
   1174      Ok(())
   1175  }