From 082ff2e370ad174c326e0d8417d5dc4928b206ab Mon Sep 17 00:00:00 2001 From: yvesf Date: Wed, 1 Jul 2009 21:25:37 +0000 Subject: icq bot an dranom upda git-svn-id: http://xapek.org/svn/common/omegle@1173 d0e8fea9-7529-0410-93fb-d39fd5b9c1dd --- omegle.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'omegle.py') diff --git a/omegle.py b/omegle.py index 395bf4b..62a3892 100644 --- a/omegle.py +++ b/omegle.py @@ -54,6 +54,7 @@ class RESTClient(object): try: headers = RESTClient.headers.copy() headers['Host'] = self.host + headers['Content-Length'] = str(len(params)) self.conn.request(method,path,params,headers) resp = self.conn.getresponse() finally: @@ -94,14 +95,14 @@ class OmegleChat(RESTClient): def disconnect(self): """Close a chat session.""" self.logger.debug("disconnect()") - self.is_connected = False + self.is_confirmed = False self.timer.stop() if self.is_confirmed: r = RESTClient.request(self,"POST", "/disconnect", urllib.urlencode({'id': self.id})) body = r.read() self.logger.debug("/disconnect sent. Read: %s" % body) if body == "win": - self.is_confirmed = False + self.is_connected = False self.id = None self.conn.close() else: @@ -110,9 +111,13 @@ class OmegleChat(RESTClient): def _events(self): """does use its own "HTTPConnection" because its called async from a thread""" conn = httplib.HTTPConnection(self.host) + params = urllib.urlencode({'id' : self.id}) + headers = OmegleChat.headers.copy() + headers['Host'] = "omegle.com" + headers['Content-Length'] = str(len(params)) conn.request("POST", "/events", - urllib.urlencode({'id' : self.id}), + params, OmegleChat.headers) r=conn.getresponse() body=r.read() -- cgit v1.2.1