Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
-
508b0523
by wurstsalat at 2023-02-19T22:34:17+01:00
1 changed file:
Changes:
| ... | ... | @@ -848,21 +848,22 @@ def get_recent_muc_nicks(self, contact: GroupchatContact) -> list[str]: |
| 848 | 848 | '''
|
| 849 | 849 | Queries the last 50 message rows and gathers nicknames in a list
|
| 850 | 850 | '''
|
| 851 | + jids = [contact.jid]
|
|
| 851 | 852 | account_id = self.get_account_id(contact.account)
|
| 853 | + kinds = map(str, [KindConstant.GC_MSG])
|
|
| 852 | 854 | |
| 853 | 855 | sql = '''
|
| 854 | 856 | SELECT contact_name
|
| 855 | - FROM logs NATURAL JOIN jids
|
|
| 856 | - WHERE +jid = ?
|
|
| 857 | - AND account_id = ?
|
|
| 858 | - AND kind = ?
|
|
| 857 | + FROM logs NATURAL JOIN jids WHERE jid IN ({jids})
|
|
| 858 | + AND account_id = {account_id}
|
|
| 859 | + AND kind IN ({kinds})
|
|
| 859 | 860 | ORDER BY time DESC
|
| 860 | - '''
|
|
| 861 | + '''.format(jids=', '.join('?' * len(jids)),
|
|
| 862 | + account_id=account_id,
|
|
| 863 | + kinds=', '.join(kinds))
|
|
| 864 | + |
|
| 861 | 865 | |
| 862 | - result = self._con.execute(sql, (contact.jid,
|
|
| 863 | - account_id,
|
|
| 864 | - KindConstant.GC_MSG
|
|
| 865 | - )).fetchmany(50)
|
|
| 866 | + result = self._con.execute(sql, (tuple(jids))).fetchmany(50)
|
|
| 866 | 867 | |
| 867 | 868 | nicknames: list[str] = []
|
| 868 | 869 | for row in result:
|