Mercurial > libervia-backend
comparison src/plugins/plugin_xep_0085.py @ 922:c897c8d321b3
core: sendMessageTrigger now manage pre and post treatments, which happen before or after XML generation
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 22 Mar 2014 15:34:05 +0100 |
parents | 1a759096ccbd |
children | 301b342c697a |
comparison
equal
deleted
inserted
replaced
921:8dd168c7741c | 922:c897c8d321b3 |
---|---|
173 if state != 'gone' or message.getAttribute('type') != 'groupchat': | 173 if state != 'gone' or message.getAttribute('type') != 'groupchat': |
174 self.host.bridge.chatStateReceived(message.getAttribute("from"), state, profile) | 174 self.host.bridge.chatStateReceived(message.getAttribute("from"), state, profile) |
175 break | 175 break |
176 return True | 176 return True |
177 | 177 |
178 def sendMessageTrigger(self, mess_data, treatments, profile): | 178 def sendMessageTrigger(self, mess_data, pre_xml_treatments, post_xml_treatments, profile): |
179 """ | 179 """ |
180 Eventually add the chat state to the message and initiate | 180 Eventually add the chat state to the message and initiate |
181 the state machine when sending an "active" state. | 181 the state machine when sending an "active" state. |
182 """ | 182 """ |
183 def treatment(mess_data): | 183 def treatment(mess_data): |
196 state = mess_data["extra"].pop("chat_state") | 196 state = mess_data["extra"].pop("chat_state") |
197 assert(state in CHAT_STATES) | 197 assert(state in CHAT_STATES) |
198 message.addElement(state, NS_CHAT_STATES) | 198 message.addElement(state, NS_CHAT_STATES) |
199 return mess_data | 199 return mess_data |
200 | 200 |
201 treatments.addCallback(treatment) | 201 post_xml_treatments.addCallback(treatment) |
202 return True | 202 return True |
203 | 203 |
204 def __checkActivation(self, to_jid, forceEntityData, profile): | 204 def __checkActivation(self, to_jid, forceEntityData, profile): |
205 """ | 205 """ |
206 @param to_joid: the contact's JID | 206 @param to_joid: the contact's JID |