Strip from the last tearline when posting to matrix
This commit is contained in:
parent
eafd203021
commit
5d9d8ed72a
@ -59,13 +59,15 @@ class Echomail extends Matrix
|
|||||||
Log::error(sprintf('%s:! Failed to set matrix room topic to [%s] in room [%s]',self::LOGKEY,$x,$room),['msg'=>$topic->body()]);
|
Log::error(sprintf('%s:! Failed to set matrix room topic to [%s] in room [%s]',self::LOGKEY,$x,$room),['msg'=>$topic->body()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$omsg = preg_replace("/\r---.*$/U",'',$this->o->msg);
|
||||||
|
|
||||||
$msg = Http::withToken(config('matrix.as_token'))
|
$msg = Http::withToken(config('matrix.as_token'))
|
||||||
->withQueryParameters(['user_id'=>$user])
|
->withQueryParameters(['user_id'=>$user])
|
||||||
->post(sprintf('https://%s/_matrix/client/v3/rooms/%s/send/m.room.message',config('matrix.server'),$room),[
|
->post(sprintf('https://%s/_matrix/client/v3/rooms/%s/send/m.room.message',config('matrix.server'),$room),[
|
||||||
'msgtype'=>'m.text',
|
'msgtype'=>'m.text',
|
||||||
'format'=>'org.matrix.custom.html',
|
'format'=>'org.matrix.custom.html',
|
||||||
'body'=>mb_convert_encoding(str_replace("\r","\n",$this->o->msg),'UTF-8','IBM850'),
|
'body'=>mb_convert_encoding(str_replace("\r","\n",$omsg),'UTF-8','IBM850'),
|
||||||
'formatted_body'=>sprintf("<pre>\n%s\n</pre>",mb_convert_encoding(str_replace("\r","\n",$this->o->msg),'UTF-8','IBM850')),
|
'formatted_body'=>sprintf("<pre>\n%s\n</pre>",mb_convert_encoding(str_replace("\r","\n",$omsg),'UTF-8','IBM850')),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
switch ($msg->status()) {
|
switch ($msg->status()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user