summaryrefslogtreecommitdiff
path: root/dumbot.py
diff options
context:
space:
mode:
authoryvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd>2009-12-12 23:38:51 +0000
committeryvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd>2009-12-12 23:38:51 +0000
commit99681ec568fb057cabd12c24813ce71e0d7fe271 (patch)
tree96afc19a590998884cc53813dfbca0e7a850929f /dumbot.py
parentfa478701c643b22ad9337db2fefd28aa1113b37d (diff)
downloadomegle-99681ec568fb057cabd12c24813ce71e0d7fe271.tar.gz
omegle-99681ec568fb057cabd12c24813ce71e0d7fe271.zip
clean
git-svn-id: http://xapek.org/svn/common/omegle@1484 d0e8fea9-7529-0410-93fb-d39fd5b9c1dd
Diffstat (limited to 'dumbot.py')
-rw-r--r--dumbot.py93
1 files changed, 0 insertions, 93 deletions
diff --git a/dumbot.py b/dumbot.py
deleted file mode 100644
index a017349..0000000
--- a/dumbot.py
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/usr/bin/python
-
-# sucked from:
-# * http://twistedmatrix.com/pipermail/twisted-python/2004-May/007903.html
-# * http://redfoot.net/hypercode/modules/xmpp/client
-
-# Twisted Imports
-from twisted.words.protocols.jabber import client, jid
-from twisted.xish import domish, xmlstream
-from twisted.internet import reactor
-
-# System Imports
-import sys, getpass
-
-name = None
-server = None
-resource = None
-password = None
-me = None
-
-thexmlstream = None
-tryandregister = 1
-
-def initOnline(xmlstream):
- global factory
- print 'Initializing...'
- xmlstream.addObserver('/message', gotMessage)
- xmlstream.addObserver('/*', gotSomething)
-
-def authd(xmlstream):
- global thexmlstream
- thexmlstream = xmlstream
- print "we've authd!"
- print repr(xmlstream)
-
- #need to send presence so clients know we're
- #actually online
- presence = domish.Element(('jabber:client', 'presence'))
- presence.addElement('status').addContent('Online')
- xmlstream.send(presence)
-
- initOnline(xmlstream)
-
-def send(author, to, msg):
- global thexmlstream
- message = domish.Element(('jabber:client','message'))
- message["to"] = jid.JID(to).full()
- message["from"] = jid.JID(author).full()
- message["type"] = "chat"
- message.addElement("body", "jabber:client", msg)
-
- thexmlstream.send(message)
-
-def gotMessage(el):
- global me
- #print 'Got message: %s' % str(el.attributes)
- from_id = el["from"]
-
- body = "empty"
- for e in el.elements():
- if e.name == "body":
- body = unicode(e.__str__())
- break
-
- body = body.split(" ")
- body.reverse()
- body = " ".join(body)
-
- send(me, from_id, body)
-
-def gotSomething(el):
- print 'Got something: %s -> %s' % (el.name, str(el.attributes))
-
-def authfailedEvent(xmlstream):
- global reactor
- print 'Auth failed!'
- reactor.stop()
-
-if __name__ == '__main__':
- USER_HANDLE = raw_input("JID: ")
- PASSWORD = getpass.getpass()
- me = USER_HANDLE + "/TwistedWords"
- myJid = jid.JID(me)
- server = USER_HANDLE[USER_HANDLE.find('@')+1:]
-
- factory = client.basicClientFactory(myJid, PASSWORD)
-
- # Register authentication callbacks
- factory.addBootstrap(xmlstream.STREAM_AUTHD_EVENT, authd)
-
- # Go!
- reactor.connectTCP(server, 5222, factory)
- reactor.run()