Mercurial > libervia-web
annotate libervia/pages/chat/page_meta.py @ 1144:2af117bfe6cc
dates update
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 19 Jan 2019 11:44:49 +0100 |
parents | 28e3eb3bb217 |
children | 29eb15062416 |
rev | line source |
---|---|
996
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr/bin/env python2.7 |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 from sat.core.i18n import _ |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
5 from twisted.internet import defer |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 from sat.core.log import getLogger |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
7 |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
8 log = getLogger("pages/chat") |
996
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 from sat.tools.common import data_objects |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 from twisted.words.protocols.jabber import jid |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 from libervia.server.constants import Const as C |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 from libervia.server import session_iface |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
14 name = u"chat" |
996
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 access = C.PAGES_ACCESS_PROFILE |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 template = u"chat/chat.html" |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 dynamic = True |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 def parse_url(self, request): |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
21 rdata = self.getRData(request) |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
22 |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
23 try: |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 target_jid_s = self.nextPath(request) |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 except IndexError: |
1000
4cc4d49e1d0f
pages (chat): moved rendering preparation in prepare_render, and redirect to page_select if no jid is specified.
Goffi <goffi@goffi.org>
parents:
996
diff
changeset
|
26 # not chat jid, we redirect to jid selection page |
4cc4d49e1d0f
pages (chat): moved rendering preparation in prepare_render, and redirect to page_select if no jid is specified.
Goffi <goffi@goffi.org>
parents:
996
diff
changeset
|
27 self.pageRedirect(u"chat_select", request) |
996
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 try: |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 target_jid = jid.JID(target_jid_s) |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 if not target_jid.user: |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
32 raise ValueError(_(u"invalid jid for chat (no local part)")) |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
33 except Exception as e: |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
34 log.warning( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
35 _(u"bad chat jid entered: {jid} ({msg})").format(jid=target_jid, msg=e) |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
36 ) |
996
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
37 self.pageError(request, C.HTTP_BAD_REQUEST) |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 else: |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
39 rdata["target"] = target_jid |
996
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
40 |
1000
4cc4d49e1d0f
pages (chat): moved rendering preparation in prepare_render, and redirect to page_select if no jid is specified.
Goffi <goffi@goffi.org>
parents:
996
diff
changeset
|
41 |
4cc4d49e1d0f
pages (chat): moved rendering preparation in prepare_render, and redirect to page_select if no jid is specified.
Goffi <goffi@goffi.org>
parents:
996
diff
changeset
|
42 @defer.inlineCallbacks |
4cc4d49e1d0f
pages (chat): moved rendering preparation in prepare_render, and redirect to page_select if no jid is specified.
Goffi <goffi@goffi.org>
parents:
996
diff
changeset
|
43 def prepare_render(self, request): |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
44 # Â FIXME: bug on room filtering (currently display messages from all rooms) |
1000
4cc4d49e1d0f
pages (chat): moved rendering preparation in prepare_render, and redirect to page_select if no jid is specified.
Goffi <goffi@goffi.org>
parents:
996
diff
changeset
|
45 session = self.host.getSessionData(request, session_iface.ISATSession) |
4cc4d49e1d0f
pages (chat): moved rendering preparation in prepare_render, and redirect to page_select if no jid is specified.
Goffi <goffi@goffi.org>
parents:
996
diff
changeset
|
46 template_data = request.template_data |
4cc4d49e1d0f
pages (chat): moved rendering preparation in prepare_render, and redirect to page_select if no jid is specified.
Goffi <goffi@goffi.org>
parents:
996
diff
changeset
|
47 rdata = self.getRData(request) |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
48 target_jid = rdata["target"] |
1000
4cc4d49e1d0f
pages (chat): moved rendering preparation in prepare_render, and redirect to page_select if no jid is specified.
Goffi <goffi@goffi.org>
parents:
996
diff
changeset
|
49 profile = session.profile |
996
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
50 profile_jid = session.jid |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
51 |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
52 disco = yield self.host.bridgeCall(u"discoInfos", target_jid.host, u"", True, profile) |
996
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
53 if "conference" in [i[0] for i in disco[1]]: |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
54 chat_type = C.CHAT_GROUP |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
55 join_ret = yield self.host.bridgeCall( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
56 u"mucJoin", target_jid.userhost(), "", "", profile |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
57 ) |
996
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
58 already_joined, room_jid_s, occupants, user_nick, room_subject, dummy = join_ret |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
59 template_data[u"subject"] = room_subject |
996
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
60 own_jid = jid.JID(room_jid_s) |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
61 own_jid.resource = user_nick |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
62 else: |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
63 chat_type = C.CHAT_ONE2ONE |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
64 own_jid = profile_jid |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
65 rdata["chat_type"] = chat_type |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
66 template_data["own_jid"] = own_jid |
996
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
67 |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
68 self.registerSignal(request, u"messageNew") |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
69 history = yield self.host.bridgeCall( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
70 u"historyGet", |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
71 profile_jid.userhost(), |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
72 target_jid.userhost(), |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
73 20, |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
74 True, |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
75 {}, |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
76 profile, |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
77 ) |
996
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
78 authors = {m[2] for m in history} |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
79 identities = {} |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
80 for author in authors: |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
81 identities[author] = yield self.host.bridgeCall(u"identityGet", author, profile) |
996
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
82 |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
83 template_data[u"messages"] = data_objects.Messages(history) |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
84 template_data[u"identities"] = identities |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
85 template_data[u"target_jid"] = target_jid |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
86 template_data[u"chat_type"] = chat_type |
996
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
87 |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
88 |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
89 def on_data(self, request, data): |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
90 session = self.host.getSessionData(request, session_iface.ISATSession) |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
91 rdata = self.getRData(request) |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
92 target = rdata["target"] |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
93 data_type = data.get(u"type", "") |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
94 if data_type == "msg": |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
95 message = data[u"body"] |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
96 mess_type = ( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
97 C.MESS_TYPE_GROUPCHAT |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
98 if rdata["chat_type"] == C.CHAT_GROUP |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
99 else C.MESS_TYPE_CHAT |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
100 ) |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
101 log.debug(u"message received: {}".format(message)) |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
102 self.host.bridgeCall( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
103 u"messageSend", |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
104 target.full(), |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
105 {u"": message}, |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
106 {}, |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
107 mess_type, |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
108 {}, |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
109 session.profile, |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
110 ) |
996
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
111 else: |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
112 log.warning(u"unknown message type: {type}".format(type=data_type)) |
996
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
113 |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
114 |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
115 @defer.inlineCallbacks |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
116 def on_signal(self, request, signal, *args): |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
117 if signal == "messageNew": |
1002
990e80aa43a9
pages (chat): fixed messages filtering + get identity of user if not already in cache.
Goffi <goffi@goffi.org>
parents:
1001
diff
changeset
|
118 rdata = self.getRData(request) |
996
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
119 template_data = request.template_data |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
120 template_data_update = {u"msg": data_objects.Message((args))} |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
121 target_jid = rdata["target"] |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
122 identities = template_data["identities"] |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
123 uid, timestamp, from_jid_s, to_jid_s, message, subject, mess_type, extra, dummy = ( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
124 args |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
125 ) |
1002
990e80aa43a9
pages (chat): fixed messages filtering + get identity of user if not already in cache.
Goffi <goffi@goffi.org>
parents:
1001
diff
changeset
|
126 from_jid = jid.JID(from_jid_s) |
990e80aa43a9
pages (chat): fixed messages filtering + get identity of user if not already in cache.
Goffi <goffi@goffi.org>
parents:
1001
diff
changeset
|
127 to_jid = jid.JID(to_jid_s) |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
128 if ( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
129 target_jid.userhostJID() != from_jid.userhostJID() |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
130 and target_jid.userhostJID() != to_jid.userhostJID() |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
131 ): |
1002
990e80aa43a9
pages (chat): fixed messages filtering + get identity of user if not already in cache.
Goffi <goffi@goffi.org>
parents:
1001
diff
changeset
|
132 # the message is not linked with page's room/user |
990e80aa43a9
pages (chat): fixed messages filtering + get identity of user if not already in cache.
Goffi <goffi@goffi.org>
parents:
1001
diff
changeset
|
133 return |
990e80aa43a9
pages (chat): fixed messages filtering + get identity of user if not already in cache.
Goffi <goffi@goffi.org>
parents:
1001
diff
changeset
|
134 |
990e80aa43a9
pages (chat): fixed messages filtering + get identity of user if not already in cache.
Goffi <goffi@goffi.org>
parents:
1001
diff
changeset
|
135 if from_jid_s not in identities: |
990e80aa43a9
pages (chat): fixed messages filtering + get identity of user if not already in cache.
Goffi <goffi@goffi.org>
parents:
1001
diff
changeset
|
136 profile = self.getProfile(request) |
1113
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
137 identities[from_jid_s] = yield self.host.bridgeCall( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
138 u"identityGet", from_jid_s, profile |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
139 ) |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
140 template_data_update["identities"] = identities |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
141 self.renderAndUpdate( |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
142 request, u"chat/message.html", "#messages", template_data_update |
cdd389ef97bc
server: code style reformatting using black
Goffi <goffi@goffi.org>
parents:
1091
diff
changeset
|
143 ) |
996
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
144 else: |
d821c112e656
pages (chat): implementation of chat page using new dynamic pages, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
145 log.error(_(u"Unexpected signal: {signal}").format(signal=signal)) |