fix: encoding
This commit is contained in:
parent
9bf963332c
commit
bbe474e78c
1 changed files with 7 additions and 2 deletions
|
@ -3,13 +3,18 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import email
|
import email
|
||||||
import pathlib
|
import pathlib
|
||||||
from os import path, listdir
|
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from os import path, listdir
|
||||||
|
from email.header import decode_header, make_header
|
||||||
from nio import (AsyncClient, Api, ClientConfig, RoomSendError)
|
from nio import (AsyncClient, Api, ClientConfig, RoomSendError)
|
||||||
from inotify_simple import INotify, flags
|
from inotify_simple import INotify, flags
|
||||||
|
|
||||||
|
|
||||||
|
def decode(header):
|
||||||
|
return make_hader(decode_header(header))
|
||||||
|
|
||||||
class Client(AsyncClient):
|
class Client(AsyncClient):
|
||||||
|
|
||||||
def send_message(self, From, Subject):
|
def send_message(self, From, Subject):
|
||||||
|
@ -18,7 +23,7 @@ class Client(AsyncClient):
|
||||||
message_type="m.room.message",
|
message_type="m.room.message",
|
||||||
content={
|
content={
|
||||||
"msgtype": "m.text",
|
"msgtype": "m.text",
|
||||||
"body": "From:\t%s\nSubject:\t%s" % (From, Subject)
|
"body": "From:\t%s\nSubject:\t%s" % (decode(From), decode(Subject))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue