Philipp Hörist pushed to branch master at gajim / gajim
Commits:
-
c45d0f5b
by Philipp Hörist at 2017-11-19T23:45:03+01:00
2 changed files:
Changes:
| ... | ... | @@ -491,3 +491,12 @@ class MucCapsCache: |
| 491 | 491 |
return True
|
| 492 | 492 |
except (KeyError, AttributeError):
|
| 493 | 493 |
return False
|
| 494 |
+ |
|
| 495 |
+ def get_mam_namespace(self, jid):
|
|
| 496 |
+ try:
|
|
| 497 |
+ if nbxmpp.NS_MAM_2 in self.cache[jid].features:
|
|
| 498 |
+ return nbxmpp.NS_MAM_2
|
|
| 499 |
+ elif nbxmpp.NS_MAM_1 in self.cache[jid].features:
|
|
| 500 |
+ return nbxmpp.NS_MAM_1
|
|
| 501 |
+ except (KeyError, AttributeError):
|
|
| 502 |
+ return
|
| ... | ... | @@ -27,6 +27,7 @@ from gajim.common import app |
| 27 | 27 |
from gajim.common import ged
|
| 28 | 28 |
from gajim.common.logger import KindConstant, JIDConstant
|
| 29 | 29 |
from gajim.common.const import ArchiveState
|
| 30 |
+from gajim.common.caps_cache import muc_caps_cache
|
|
| 30 | 31 |
import gajim.common.connection_handlers_events as ev
|
| 31 | 32 |
|
| 32 | 33 |
log = logging.getLogger('gajim.c.message_archiving')
|
| ... | ... | @@ -296,7 +297,12 @@ class ConnectionArchive313: |
| 296 | 297 |
|
| 297 | 298 |
def get_archive_query(self, query_id, jid=None, start=None, end=None, with_=None,
|
| 298 | 299 |
after=None, max_=30):
|
| 299 |
- namespace = self.archiving_namespace
|
|
| 300 |
+ # Muc archive query?
|
|
| 301 |
+ namespace = muc_caps_cache.get_mam_namespace(jid)
|
|
| 302 |
+ if namespace is None:
|
|
| 303 |
+ # Query to our own archive
|
|
| 304 |
+ namespace = self.archiving_namespace
|
|
| 305 |
+ |
|
| 300 | 306 |
iq = nbxmpp.Iq('set', to=jid)
|
| 301 | 307 |
query = iq.addChild('query', namespace=namespace)
|
| 302 | 308 |
form = query.addChild(node=nbxmpp.DataForm(typ='submit'))
|