summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/PluginThread.py15
-rw-r--r--module/plugins/hooks/MultiHome.py2
-rw-r--r--module/plugins/hooks/XMPPInterface.py26
3 files changed, 30 insertions, 13 deletions
diff --git a/module/PluginThread.py b/module/PluginThread.py
index 20bef84df..3f24db345 100644
--- a/module/PluginThread.py
+++ b/module/PluginThread.py
@@ -216,16 +216,19 @@ class DownloadThread(PluginThread):
except error, e:
#@TODO determine correct error codes
- try:
- code, msg = e.args
- except:
- code = 0
+ if len(e.args) > 1:
+ code = e.args[0]
+ msg = e.args[1:]
+ else:
+ code = -1
msg = e.args
+ if "timed out" in msg:
+ code = 990
self.m.log.debug("socket error %s: %s" % (code, msg))
- if code in (7, 18, 28, 52, 56, 104):
- self.m.log.warning(_("Couldn't connect to host or connection resetted waiting 1 minute and retry."))
+ if code in (104, 990):
+ self.m.log.warning(_("Couldn't connect to host or connection resetted, waiting 1 minute and retry."))
wait = time() + 60
while time() < wait:
sleep(1)
diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py
index b9b6ac5b7..88491f6f4 100644
--- a/module/plugins/hooks/MultiHome.py
+++ b/module/plugins/hooks/MultiHome.py
@@ -49,7 +49,7 @@ class MultiHome(Hook):
def coreReady(self):
requestFactory = self.core.requestFactory
oldGetRequest = requestFactory.getRequest
- def getRequest(pluginName, account=None, type="HTTP"):
+ def getRequest(pluginName, account=None):
iface = self.bestInterface(pluginName, account)
if iface:
iface.useFor(pluginName, account)
diff --git a/module/plugins/hooks/XMPPInterface.py b/module/plugins/hooks/XMPPInterface.py
index 68689cfd3..dd0cd2f28 100644
--- a/module/plugins/hooks/XMPPInterface.py
+++ b/module/plugins/hooks/XMPPInterface.py
@@ -97,6 +97,15 @@ class XMPPInterface(IRCInterface, JabberClient):
know what is going on."""
self.log.debug("pyLoad XMPP: *** State changed: %s %r ***" % (state,arg) )
+ def disconnected(self):
+ self.log.debug("pyLoad XMPP: Client was disconnected")
+
+ def stream_closed(self,stream):
+ self.log.debug("pyLoad XMPP: Stream was closed | %s" % stream)
+
+ def stream_error(self,err):
+ self.log.debug("pyLoad XMPP: Stream Error: %s" % err)
+
def get_message_handlers(self):
"""Return list of (message_type, message_handler) tuples.
@@ -111,8 +120,8 @@ class XMPPInterface(IRCInterface, JabberClient):
subject=stanza.get_subject()
body=stanza.get_body()
t=stanza.get_type()
- self.log.debug(_(u'pyLoad XMPP: Message from %s received.') % (unicode(stanza.get_from(),)))
- self.log.debug(_(u'pyLoad XMPP: Body: %s') % body)
+ self.log.debug(u'pyLoad XMPP: Message from %s received.' % (unicode(stanza.get_from(),)))
+ self.log.debug(u'pyLoad XMPP: Body: %s' % body)
if stanza.get_type()=="headline":
# 'headline' messages should never be replied to
@@ -165,8 +174,8 @@ class XMPPInterface(IRCInterface, JabberClient):
def announce(self, message):
""" send message to all owners"""
for user in self.getConfig("owners").split(";"):
-
- self.log.debug(_("pyLoad XMPP: Send message to %s") % user)
+
+ self.log.debug("pyLoad XMPP: Send message to %s" % user)
to_jid = JID(user)
@@ -174,8 +183,13 @@ class XMPPInterface(IRCInterface, JabberClient):
to_jid=to_jid,
stanza_type="chat",
body=message)
-
- self.stream.send(m)
+
+ stream = self.get_stream()
+ if not stream:
+ self.connect()
+ stream = self.get_stream()
+
+ stream.send(m)
class VersionHandler(object):