Matrix txnid fix (#12057)

* Fix Matrix alerting txnid

This fixes the issue I brought up in #12018.  I can confirm that I now get a new message from the LibreNMS bot every time I test my Matrix transport.

* Update AUTHORS.md
This commit is contained in:
thomcatdotrocks 2020-09-04 09:38:19 -05:00 committed by GitHub
parent 19cb90439c
commit dfab530525
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -215,6 +215,7 @@ LibreNMS contributors:
- Pavle Obradovic <pobradovic08@gmail.com> (pobradovic08)
- Jason Cheng <sanyu3u@gmail.com> (jasoncheng7115)
- Daniel Baeza <doctoruve@gmail.com> (TheGreatDoc)
- Thom Cleary <me@thomcat.rocks> (thomcatdotrocks)
Observium was written by:
- Adam Armstrong

View File

@ -43,9 +43,10 @@ class Matrix extends Transport
{
$request_opts = [];
$request_heads = [];
$txnid = rand(1111, 9999) . time();
$server = preg_replace('/\/$/', '', $server);
$host = $server."/_matrix/client/r0/rooms/".urlencode($room)."/send/m.room.message/".$obj['uid'];
$host = $server."/_matrix/client/r0/rooms/".urlencode($room)."/send/m.room.message/".$txnid;
$request_heads['Authorization'] = "Bearer $authtoken";
$request_heads['Content-Type'] = "application/json";