import utils
from twisted.internet import reactor, task, protocol, error
-from tlib.xmlw import Element, jid
+from twisted.words.xish.domish import Element
+from twisted.words.protocols.jabber.jid import internJID
from debug import LogEvent, INFO, WARN, ERROR
import svninfo
import jabw
ID = el.getAttribute("id")
ulang = utils.getLang(el)
- if config.admins.count(jid.intern(to).userhost()) == 0:
+ if config.admins.count(internJID(to).userhost()) == 0:
self.pytrans.discovery.sendIqError(to=to, fro=config.jid, ID=ID, xmlns=disco.COMMANDS, etype="cancel", condition="not-authorized")
return
def incomingIq(self, el):
itype = el.getAttribute("type")
fro = el.getAttribute("from")
- froj = jid.intern(fro)
+ froj = internJID(fro)
to = el.getAttribute("to")
ID = el.getAttribute("id")
def incomingIq(self, el):
itype = el.getAttribute("type")
fro = el.getAttribute("from")
- froj = jid.intern(fro)
+ froj = internJID(fro)
to = el.getAttribute("to")
- toj = jid.intern(to)
+ toj = internJID(to)
ID = el.getAttribute("id")
if itype != "get" and itype != "error":
self.pytrans.discovery.sendIqError(to=fro, fro=config.jid, ID=ID, xmlns="vcard-temp", etype="cancel", condition="feature-not-implemented")
def incomingIq(self, el):
itype = el.getAttribute("type")
fro = el.getAttribute("from")
- froj = jid.intern(fro)
+ froj = internJID(fro)
to = el.getAttribute("to")
- toj = jid.intern(to)
+ toj = internJID(to)
ID = el.getAttribute("id")
if(itype != "get" and itype != "error"):
else:
return errOut()
- froj = jid.intern(el.getAttribute("from"))
- toj = jid.intern(el.getAttribute("to"))
+ froj = internJID(el.getAttribute("from"))
+ toj = internJID(el.getAttribute("to"))
session = self.pytrans.sessions.get(froj.userhost(), None)
if not session:
return errOut()
def errOut():
self.pytrans.discovery.sendIqError(to=el.getAttribute("from"), fro=el.getAttribute("to"), ID=ID, xmlns=disco.SI, etype="cancel", condition="bad-request")
- toj = jid.intern(el.getAttribute("to"))
- froj = jid.intern(el.getAttribute("from"))
+ toj = internJID(el.getAttribute("to"))
+ froj = internJID(el.getAttribute("from"))
session = self.pytrans.sessions.get(froj.userhost(), None)
if not session:
return errOut()
if el.getAttribute("type") != "set":
return errOut()
- toj = jid.intern(el.getAttribute("to"))
- froj = jid.intern(el.getAttribute("from"))
+ toj = internJID(el.getAttribute("to"))
+ froj = internJID(el.getAttribute("from"))
query = el.query
if not (query and query.getAttribute("mode", "tcp") == "tcp"):
except error.NotConnectingError:
pass
+ if factory.streamHostTimeout:
+ factory.streamHostTimeout.cancel()
+ factory.streamHostTimeout = None
+
iq = Element((None, "iq"))
iq["type"] = "result"
iq["from"] = toj.full()
# Try the streamhosts
+ LogEvent(INFO)
factory = protocol.ClientFactory()
factory.protocol = ft.JEP65ConnectionSend
factory.consumer = consumer
factory.hash = utils.socks5Hash(sid, froj.full(), toj.full())
factory.madeConnection = gotStreamhost
factory.connectors = []
+ factory.streamHostTimeout = reactor.callLater(120, consumer.error)
+
for streamhost in streamhosts:
factory.connectors.append(reactor.connectTCP(streamhost[1], streamhost[2], factory))