Skip to content
  • Daniel García Moreno's avatar
    api: Use md5 as unique message id instead of i32 · 8d5e98f2
    Daniel García Moreno authored
    We were using an integer for the message id when we were sending a
    message. This id was incremented with each message sent.
    
    Reading the matrix server documentation I've discovered that this id
    should be unique:
    
    > Clients should generate an ID unique across requests with the same
    > access token; it will be used by the server to ensure idempotency of
    > requests.
    
    So this was a problem. I think that this is because some messages never
    got sent to the server and we don't get any error back.
    
    To fix that now we generate an unique id for each message using the room
    id, the message body and the message date, we concatenate that and make
    an md5 sum, so this should be unique.
    
    https://matrix.org/docs/spec/client_server/r0.3.0.html#put-matrix-client-r0-rooms-roomid-send-eventtype-txnid
    
    See #201
    8d5e98f2