Compare commits
No commits in common. "95d08e5aeb4ed538871c0768a16661d354a80a7b" and "d44c84379973808e07fcdd163731114b5e086a66" have entirely different histories.
95d08e5aeb
...
d44c843799
@ -84,15 +84,15 @@ class Message:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def get_closest_before(
|
async def get_closest_before(
|
||||||
cls, kt_chat: int, kt_receiver: int, ktid: Long
|
cls, kt_chat: int, kt_receiver: int, timestamp: int
|
||||||
) -> Message | None:
|
) -> Message | None:
|
||||||
q = (
|
q = (
|
||||||
f"SELECT {cls.columns} "
|
f"SELECT {cls.columns} "
|
||||||
"FROM message WHERE kt_chat=$1 AND kt_receiver=$2 AND ktid<=$3 AND "
|
"FROM message WHERE kt_chat=$1 AND kt_receiver=$2 AND timestamp<=$3 AND "
|
||||||
" ktid IS NOT NULL "
|
" ktid IS NOT NULL "
|
||||||
"ORDER BY ktid DESC LIMIT 1"
|
"ORDER BY timestamp DESC LIMIT 1"
|
||||||
)
|
)
|
||||||
row = await cls.db.fetchrow(q, kt_chat, kt_receiver, ktid)
|
row = await cls.db.fetchrow(q, kt_chat, kt_receiver, timestamp)
|
||||||
return cls._from_optional_row(row)
|
return cls._from_optional_row(row)
|
||||||
|
|
||||||
_insert_query = (
|
_insert_query = (
|
||||||
|
@ -1277,20 +1277,6 @@ class Portal(DBPortal, BasePortal):
|
|||||||
await self.main_intent.redact(message.mx_room, message.mxid, timestamp=timestamp)
|
await self.main_intent.redact(message.mx_room, message.mxid, timestamp=timestamp)
|
||||||
await message.delete()
|
await message.delete()
|
||||||
|
|
||||||
async def handle_kakaotalk_chat_read(self, source: u.User, sender: p.Puppet, chat_id: Long) -> None:
|
|
||||||
if not self.mxid:
|
|
||||||
return
|
|
||||||
msg = await DBMessage.get_closest_before(self.ktid, self.kt_receiver, chat_id)
|
|
||||||
if not msg:
|
|
||||||
return
|
|
||||||
if not await self._bridge_own_message_pm(source, sender, "read receipt", invite=False):
|
|
||||||
return
|
|
||||||
# NOTE No need for timestamp when the read receipt happened, since this is only for live ones
|
|
||||||
await sender.intent_for(self).mark_read(msg.mx_room, msg.mxid)
|
|
||||||
self.log.debug(
|
|
||||||
f"Handled KakaoTalk read receipt from {sender.ktid} up to {chat_id}/{msg.mxid}"
|
|
||||||
)
|
|
||||||
|
|
||||||
async def handle_kakaotalk_user_join(
|
async def handle_kakaotalk_user_join(
|
||||||
self, source: u.User, user: p.Puppet
|
self, source: u.User, user: p.Puppet
|
||||||
) -> None:
|
) -> None:
|
||||||
|
@ -736,7 +736,7 @@ class User(DBUser, BaseUser):
|
|||||||
)
|
)
|
||||||
if portal and portal.mxid:
|
if portal and portal.mxid:
|
||||||
await portal.backfill_lock.wait(f"read receipt from {sender_id}")
|
await portal.backfill_lock.wait(f"read receipt from {sender_id}")
|
||||||
await portal.handle_kakaotalk_chat_read(self, puppet, chat_id)
|
await portal.handle_kakaotalk_read(self, puppet, chat_id)
|
||||||
|
|
||||||
@async_time(METRIC_PROFILE_CHANGE)
|
@async_time(METRIC_PROFILE_CHANGE)
|
||||||
async def on_profile_changed(self, info: OpenLinkChannelUserInfo) -> None:
|
async def on_profile_changed(self, info: OpenLinkChannelUserInfo) -> None:
|
||||||
|
@ -10,7 +10,6 @@ NotifyAccess=all
|
|||||||
WorkingDirectory=/opt/matrix-appservice-kakaotalk/node
|
WorkingDirectory=/opt/matrix-appservice-kakaotalk/node
|
||||||
ConfigurationDirectory=matrix-appservice-kakaotalk
|
ConfigurationDirectory=matrix-appservice-kakaotalk
|
||||||
RuntimeDirectory=matrix-appservice-kakaotalk
|
RuntimeDirectory=matrix-appservice-kakaotalk
|
||||||
RuntimeDirectoryPreserve=yes
|
|
||||||
ExecStart=/usr/bin/env node src/main.js --config ${CONFIGURATION_DIRECTORY}/node-config.json
|
ExecStart=/usr/bin/env node src/main.js --config ${CONFIGURATION_DIRECTORY}/node-config.json
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartSec=3
|
RestartSec=3
|
||||||
|
@ -8,7 +8,6 @@ After=multi-user.target network.target
|
|||||||
WorkingDirectory=/opt/matrix-appservice-kakaotalk
|
WorkingDirectory=/opt/matrix-appservice-kakaotalk
|
||||||
ConfigurationDirectory=matrix-appservice-kakaotalk
|
ConfigurationDirectory=matrix-appservice-kakaotalk
|
||||||
RuntimeDirectory=matrix-appservice-kakaotalk
|
RuntimeDirectory=matrix-appservice-kakaotalk
|
||||||
RuntimeDirectoryPreserve=yes
|
|
||||||
ExecStart=/opt/matrix-appservice-kakaotalk/.venv/bin/python -m matrix_appservice_kakaotalk -c ${CONFIGURATION_DIRECTORY}/config.yaml
|
ExecStart=/opt/matrix-appservice-kakaotalk/.venv/bin/python -m matrix_appservice_kakaotalk -c ${CONFIGURATION_DIRECTORY}/config.yaml
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartSec=3
|
RestartSec=3
|
||||||
|
Loading…
Reference in New Issue
Block a user