GoogleTranslationPlugin often causes errors
Traceback (most recent call last):
File "/home/test/gajim/src/common/xmpp/idlequeue.py", line 528, in _process_events
return IdleQueue._process_events(self, fd, flags)
File "/home/test/gajim/src/common/xmpp/idlequeue.py", line 393, in _process_events
obj.pollin()
File "/home/test/gajim/src/common/xmpp/transports_nb.py", line 414, in pollin
self._do_receive()
File "/home/test/gajim/src/common/xmpp/transports_nb.py", line 600, in _do_receive
self._on_receive(received)
File "/home/test/gajim/src/common/xmpp/transports_nb.py", line 614, in _on_receive
self.on_receive(data)
File "/home/test/gajim/src/common/xmpp/dispatcher_nb.py", line 452, in dispatch
handler['func'](session, stanza)
File "/home/test/gajim/src/common/connection_handlers.py", line 1409, in _messageCB
"""
File "/home/test/gajim/src/common/nec.py", line 62, in push_incoming_event
self._generate_events_based_on_incoming_event(event_object)
File "/home/test/gajim/src/common/nec.py", line 80, in _generate_events_based_on_incoming_event
if new_event_object.generate():
File "../plugins/google_translation/plugin.py", line 107, in generate
msg_type = self.base_event.stanza.attrs.get('type', None)
AttributeError: 'NetworkEvent' object has no attribute 'xmpp_msg'
Patch:
diff -r 53102f47b5ba plugins/google_translation/plugin.py
--- a/plugins/google_translation/plugin.py Sun Oct 24 15:33:19 2010 +0200
+++ b/plugins/google_translation/plugin.py Mon Oct 25 10:52:36 2010 +0400
@@ -104,13 +104,13 @@
base_network_events = ['raw-message-received']
def generate(self):
- msg_type = self.base_event.xmpp_msg.attrs.get('type', None)
+ msg_type = self.base_event.stanza.attrs.get('type', None)
if msg_type == u'chat':
- msg_text = "".join(self.base_event.xmpp_msg.kids[0].data)
+ msg_text = "".join(self.base_event.stanza.kids[0].data)
if msg_text:
from_lang = self.plugin.config['from_lang']
to_lang = self.plugin.config['to_lang']
- self.base_event.xmpp_msg.kids[0].setData(
+ self.base_event.stanza.kids[0].setData(
self.plugin.translate_text(msg_text, from_lang, to_lang))
# We only want to modify old event, not emit another, so we return False