1 | #!/usr/bin/env python2.7 |
---|
2 | # |
---|
3 | # skyped.py |
---|
4 | # |
---|
5 | # Copyright (c) 2007-2013 by Miklos Vajna <vmiklos@vmiklos.hu> |
---|
6 | # |
---|
7 | # This program is free software; you can redistribute it and/or modify |
---|
8 | # it under the terms of the GNU General Public License as published by |
---|
9 | # the Free Software Foundation; either version 2 of the License, or |
---|
10 | # (at your option) any later version. |
---|
11 | # |
---|
12 | # This program is distributed in the hope that it will be useful, |
---|
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | # GNU General Public License for more details. |
---|
16 | # |
---|
17 | # You should have received a copy of the GNU General Public License |
---|
18 | # along with this program; if not, write to the Free Software |
---|
19 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
---|
20 | # USA. |
---|
21 | # |
---|
22 | |
---|
23 | import sys |
---|
24 | import os |
---|
25 | import signal |
---|
26 | import locale |
---|
27 | import time |
---|
28 | import socket |
---|
29 | import getopt |
---|
30 | import Skype4Py |
---|
31 | import hashlib |
---|
32 | from ConfigParser import ConfigParser, NoOptionError |
---|
33 | from traceback import print_exception |
---|
34 | from fcntl import fcntl, F_SETFD, FD_CLOEXEC |
---|
35 | import ssl |
---|
36 | |
---|
37 | __version__ = "0.1.1" |
---|
38 | |
---|
39 | try: |
---|
40 | import gobject |
---|
41 | hasgobject = True |
---|
42 | except ImportError: |
---|
43 | import select |
---|
44 | import threading |
---|
45 | hasgobject = False |
---|
46 | |
---|
47 | def eh(type, value, tb): |
---|
48 | global options |
---|
49 | |
---|
50 | if type != KeyboardInterrupt: |
---|
51 | print_exception(type, value, tb) |
---|
52 | if hasgobject: |
---|
53 | gobject.MainLoop().quit() |
---|
54 | if options.conn: |
---|
55 | options.conn.close() |
---|
56 | # shut down client if it's running |
---|
57 | try: |
---|
58 | skype.skype.Client.Shutdown() |
---|
59 | except NameError: |
---|
60 | pass |
---|
61 | sys.exit("Exiting.") |
---|
62 | |
---|
63 | sys.excepthook = eh |
---|
64 | |
---|
65 | def wait_for_lock(lock, timeout_to_print, timeout, msg): |
---|
66 | start = time.time() |
---|
67 | locked = lock.acquire(0) |
---|
68 | while not(locked): |
---|
69 | time.sleep(0.5) |
---|
70 | if timeout_to_print and (time.time() - timeout_to_print > start): |
---|
71 | dprint("%s: Waited %f seconds" % \ |
---|
72 | (msg, time.time() - start)) |
---|
73 | timeout_to_print = False |
---|
74 | if timeout and (time.time() - timeout > start): |
---|
75 | dprint("%s: Waited %f seconds, giving up" % \ |
---|
76 | (msg, time.time() - start)) |
---|
77 | return False |
---|
78 | locked = lock.acquire(0) |
---|
79 | return True |
---|
80 | |
---|
81 | def input_handler(fd, io_condition = None): |
---|
82 | global options |
---|
83 | global skype |
---|
84 | if options.buf: |
---|
85 | for i in options.buf: |
---|
86 | skype.send(i.strip()) |
---|
87 | options.buf = None |
---|
88 | if not hasgobject: |
---|
89 | return True |
---|
90 | else: |
---|
91 | if not hasgobject: |
---|
92 | close_socket = False |
---|
93 | if wait_for_lock(options.lock, 3, 10, "input_handler"): |
---|
94 | try: |
---|
95 | input = fd.recv(1024) |
---|
96 | options.lock.release() |
---|
97 | except Exception, s: |
---|
98 | dprint("Warning, receiving 1024 bytes failed (%s)." % s) |
---|
99 | fd.close() |
---|
100 | options.conn = False |
---|
101 | options.lock.release() |
---|
102 | return False |
---|
103 | for i in input.split("\n"): |
---|
104 | if i.strip() == "SET USERSTATUS OFFLINE": |
---|
105 | close_socket = True |
---|
106 | skype.send(i.strip()) |
---|
107 | return not(close_socket) |
---|
108 | try: |
---|
109 | input = fd.recv(1024) |
---|
110 | except Exception, s: |
---|
111 | dprint("Warning, receiving 1024 bytes failed (%s)." % s) |
---|
112 | fd.close() |
---|
113 | return False |
---|
114 | for i in input.split("\n"): |
---|
115 | skype.send(i.strip()) |
---|
116 | return True |
---|
117 | |
---|
118 | def skype_idle_handler(skype): |
---|
119 | try: |
---|
120 | c = skype.skype.Command("PING", Block=True) |
---|
121 | skype.skype.SendCommand(c) |
---|
122 | except (Skype4Py.SkypeAPIError, AttributeError), s: |
---|
123 | dprint("Warning, pinging Skype failed (%s)." % (s)) |
---|
124 | time.sleep(1) |
---|
125 | return True |
---|
126 | |
---|
127 | def send(sock, txt): |
---|
128 | global options |
---|
129 | from time import sleep |
---|
130 | count = 1 |
---|
131 | done = False |
---|
132 | if hasgobject: |
---|
133 | while (not done) and (count < 10): |
---|
134 | try: |
---|
135 | sock.send(txt) |
---|
136 | done = True |
---|
137 | except Exception, s: |
---|
138 | count += 1 |
---|
139 | dprint("Warning, sending '%s' failed (%s). count=%d" % (txt, s, count)) |
---|
140 | sleep(1) |
---|
141 | if not done: |
---|
142 | options.conn.close() |
---|
143 | else: |
---|
144 | while (not done) and (count < 10) and options.conn: |
---|
145 | if wait_for_lock(options.lock, 3, 10, "socket send"): |
---|
146 | try: |
---|
147 | if options.conn: sock.send(txt) |
---|
148 | options.lock.release() |
---|
149 | done = True |
---|
150 | except Exception, s: |
---|
151 | options.lock.release() |
---|
152 | count += 1 |
---|
153 | dprint("Warning, sending '%s' failed (%s). count=%d" % (txt, s, count)) |
---|
154 | sleep(1) |
---|
155 | if not done: |
---|
156 | if options.conn: |
---|
157 | options.conn.close() |
---|
158 | options.conn = False |
---|
159 | return done |
---|
160 | |
---|
161 | def bitlbee_idle_handler(skype): |
---|
162 | global options |
---|
163 | done = False |
---|
164 | if options.conn: |
---|
165 | try: |
---|
166 | e = "PING" |
---|
167 | done = send(options.conn, "%s\n" % e) |
---|
168 | except Exception, s: |
---|
169 | dprint("Warning, sending '%s' failed (%s)." % (e, s)) |
---|
170 | if hasgobject: |
---|
171 | options.conn.close() |
---|
172 | else: |
---|
173 | if options.conn: options.conn.close() |
---|
174 | options.conn = False |
---|
175 | done = False |
---|
176 | if hasgobject: |
---|
177 | return True |
---|
178 | else: |
---|
179 | return done |
---|
180 | return True |
---|
181 | |
---|
182 | def server(host, port, skype = None): |
---|
183 | global options |
---|
184 | if ":" in host: |
---|
185 | sock = socket.socket(socket.AF_INET6) |
---|
186 | else: |
---|
187 | sock = socket.socket() |
---|
188 | sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) |
---|
189 | fcntl(sock, F_SETFD, FD_CLOEXEC); |
---|
190 | sock.bind((host, port)) |
---|
191 | sock.listen(1) |
---|
192 | |
---|
193 | if hasgobject: |
---|
194 | gobject.io_add_watch(sock, gobject.IO_IN, listener) |
---|
195 | else: |
---|
196 | dprint("Waiting for connection...") |
---|
197 | listener(sock, skype) |
---|
198 | |
---|
199 | def listener(sock, skype): |
---|
200 | global options |
---|
201 | if not hasgobject: |
---|
202 | if not(wait_for_lock(options.lock, 3, 10, "listener")): return False |
---|
203 | rawsock, addr = sock.accept() |
---|
204 | try: |
---|
205 | options.conn = ssl.wrap_socket(rawsock, |
---|
206 | server_side=True, |
---|
207 | certfile=options.config.sslcert, |
---|
208 | keyfile=options.config.sslkey, |
---|
209 | ssl_version=ssl.PROTOCOL_TLSv1) |
---|
210 | except ssl.SSLError: |
---|
211 | dprint("Warning, SSL init failed, did you create your certificate?") |
---|
212 | return False |
---|
213 | if hasattr(options.conn, 'handshake'): |
---|
214 | try: |
---|
215 | options.conn.handshake() |
---|
216 | except Exception: |
---|
217 | if not hasgobject: |
---|
218 | options.lock.release() |
---|
219 | dprint("Warning, handshake failed, closing connection.") |
---|
220 | return False |
---|
221 | ret = 0 |
---|
222 | try: |
---|
223 | line = options.conn.recv(1024) |
---|
224 | if line.startswith("USERNAME") and line.split(' ')[1].strip() == options.config.username: |
---|
225 | ret += 1 |
---|
226 | line = options.conn.recv(1024) |
---|
227 | if line.startswith("PASSWORD") and hashlib.sha1(line.split(' ')[1].strip()).hexdigest() == options.config.password: |
---|
228 | ret += 1 |
---|
229 | except Exception, s: |
---|
230 | dprint("Warning, receiving 1024 bytes failed (%s)." % s) |
---|
231 | options.conn.close() |
---|
232 | if not hasgobject: |
---|
233 | options.conn = False |
---|
234 | options.lock.release() |
---|
235 | return False |
---|
236 | if ret == 2: |
---|
237 | dprint("Username and password OK.") |
---|
238 | options.conn.send("PASSWORD OK\n") |
---|
239 | if hasgobject: |
---|
240 | gobject.io_add_watch(options.conn, gobject.IO_IN, input_handler) |
---|
241 | else: |
---|
242 | options.lock.release() |
---|
243 | serverloop(options, skype) |
---|
244 | return True |
---|
245 | else: |
---|
246 | dprint("Username and/or password WRONG.") |
---|
247 | options.conn.send("PASSWORD KO\n") |
---|
248 | if not hasgobject: |
---|
249 | options.conn.close() |
---|
250 | options.conn = False |
---|
251 | options.lock.release() |
---|
252 | return False |
---|
253 | |
---|
254 | def dprint(msg): |
---|
255 | from time import strftime |
---|
256 | global options |
---|
257 | |
---|
258 | now = strftime("%Y-%m-%d %H:%M:%S") |
---|
259 | |
---|
260 | if options.debug: |
---|
261 | try: |
---|
262 | print now + ": " + msg |
---|
263 | except Exception, s: |
---|
264 | try: |
---|
265 | sanitized = msg.encode("ascii", "backslashreplace") |
---|
266 | except Error, s: |
---|
267 | try: |
---|
268 | sanitized = "hex [" + msg.encode("hex") + "]" |
---|
269 | except Error, s: |
---|
270 | sanitized = "[unable to print debug message]" |
---|
271 | print now + "~=" + sanitized |
---|
272 | sys.stdout.flush() |
---|
273 | if options.log: |
---|
274 | sock = open(options.log, "a") |
---|
275 | sock.write("%s: %s\n" % (now, msg)) |
---|
276 | sock.close() |
---|
277 | |
---|
278 | class MockedSkype: |
---|
279 | """Mock class for Skype4Py.Skype(), in case the -m option is used.""" |
---|
280 | def __init__(self, mock): |
---|
281 | sock = open(mock) |
---|
282 | self.lines = sock.readlines() |
---|
283 | |
---|
284 | def SendCommand(self, c): |
---|
285 | pass |
---|
286 | |
---|
287 | def Command(self, msg, Block): |
---|
288 | if msg == "PING": |
---|
289 | return ["PONG"] |
---|
290 | line = self.lines[0].strip() |
---|
291 | if not line.startswith(">> "): |
---|
292 | raise Exception("Corrupted mock input") |
---|
293 | line = line[3:] |
---|
294 | if line != msg: |
---|
295 | raise Exception("'%s' != '%s'" % (line, msg)) |
---|
296 | self.lines = self.lines[1:] # drop the expected incoming line |
---|
297 | ret = [] |
---|
298 | while True: |
---|
299 | # and now send back all the following lines, up to the next expected incoming line |
---|
300 | if len(self.lines) == 0: |
---|
301 | break |
---|
302 | if self.lines[0].startswith(">> "): |
---|
303 | break |
---|
304 | if not self.lines[0].startswith("<< "): |
---|
305 | raise Exception("Corrupted mock input") |
---|
306 | ret.append(self.lines[0][3:].strip()) |
---|
307 | self.lines = self.lines[1:] |
---|
308 | return ret |
---|
309 | |
---|
310 | class SkypeApi: |
---|
311 | def __init__(self, mock): |
---|
312 | if not mock: |
---|
313 | self.skype = Skype4Py.Skype() |
---|
314 | self.skype.OnNotify = self.recv |
---|
315 | self.skype.Client.Start() |
---|
316 | else: |
---|
317 | self.skype = MockedSkype(mock) |
---|
318 | |
---|
319 | def recv(self, msg_text): |
---|
320 | global options |
---|
321 | if msg_text == "PONG": |
---|
322 | return |
---|
323 | if "\n" in msg_text: |
---|
324 | # crappy skype prefixes only the first line for |
---|
325 | # multiline messages so we need to do so for the other |
---|
326 | # lines, too. this is something like: |
---|
327 | # 'CHATMESSAGE id BODY first line\nsecond line' -> |
---|
328 | # 'CHATMESSAGE id BODY first line\nCHATMESSAGE id BODY second line' |
---|
329 | prefix = " ".join(msg_text.split(" ")[:3]) |
---|
330 | msg_text = ["%s %s" % (prefix, i) for i in " ".join(msg_text.split(" ")[3:]).split("\n")] |
---|
331 | else: |
---|
332 | msg_text = [msg_text] |
---|
333 | for i in msg_text: |
---|
334 | try: |
---|
335 | # Internally, BitlBee always uses UTF-8 and encodes/decodes as |
---|
336 | # necessary to communicate with the IRC client; thus send the |
---|
337 | # UTF-8 it expects |
---|
338 | e = i.encode('UTF-8') |
---|
339 | except: |
---|
340 | # Should never happen, but it's better to send difficult to |
---|
341 | # read data than crash because some message couldn't be encoded |
---|
342 | e = i.encode('ascii', 'backslashreplace') |
---|
343 | if options.conn: |
---|
344 | dprint('<< ' + e) |
---|
345 | try: |
---|
346 | send(options.conn, e + "\n") |
---|
347 | except Exception, s: |
---|
348 | dprint("Warning, sending '%s' failed (%s)." % (e, s)) |
---|
349 | if options.conn: options.conn.close() |
---|
350 | options.conn = False |
---|
351 | else: |
---|
352 | dprint('-- ' + e) |
---|
353 | |
---|
354 | def send(self, msg_text): |
---|
355 | if not len(msg_text) or msg_text == "PONG": |
---|
356 | if msg_text == "PONG": |
---|
357 | options.last_bitlbee_pong = time.time() |
---|
358 | return |
---|
359 | try: |
---|
360 | # Internally, BitlBee always uses UTF-8 and encodes/decodes as |
---|
361 | # necessary to communicate with the IRC client; thus decode the |
---|
362 | # UTF-8 it sent us |
---|
363 | e = msg_text.decode('UTF-8') |
---|
364 | except: |
---|
365 | # Should never happen, but it's better to send difficult to read |
---|
366 | # data to Skype than to crash |
---|
367 | e = msg_text.decode('ascii', 'backslashreplace') |
---|
368 | dprint('>> ' + e) |
---|
369 | try: |
---|
370 | c = self.skype.Command(e, Block=True) |
---|
371 | self.skype.SendCommand(c) |
---|
372 | if hasattr(c, "Reply"): |
---|
373 | self.recv(c.Reply) # Skype4Py answer |
---|
374 | else: |
---|
375 | for i in c: # mock may return multiple iterable answers |
---|
376 | self.recv(i) |
---|
377 | except Skype4Py.SkypeError: |
---|
378 | pass |
---|
379 | except Skype4Py.SkypeAPIError, s: |
---|
380 | dprint("Warning, sending '%s' failed (%s)." % (e, s)) |
---|
381 | |
---|
382 | class Options: |
---|
383 | def __init__(self): |
---|
384 | self.cfgpath = os.path.join(os.environ['HOME'], ".skyped", "skyped.conf") |
---|
385 | # fall back to system-wide settings |
---|
386 | self.syscfgpath = "/usr/local/etc/skyped/skyped.conf" |
---|
387 | if os.path.exists(self.syscfgpath) and not os.path.exists(self.cfgpath): |
---|
388 | self.cfgpath = self.syscfgpath |
---|
389 | self.daemon = True |
---|
390 | self.debug = False |
---|
391 | self.help = False |
---|
392 | self.host = "0.0.0.0" |
---|
393 | self.log = None |
---|
394 | self.port = None |
---|
395 | self.version = False |
---|
396 | # well, this is a bit hackish. we store the socket of the last connected client |
---|
397 | # here and notify it. maybe later notify all connected clients? |
---|
398 | self.conn = None |
---|
399 | # this will be read first by the input handler |
---|
400 | self.buf = None |
---|
401 | self.mock = None |
---|
402 | |
---|
403 | |
---|
404 | def usage(self, ret): |
---|
405 | print """Usage: skyped [OPTION]... |
---|
406 | |
---|
407 | skyped is a daemon that acts as a tcp server on top of a Skype instance. |
---|
408 | |
---|
409 | Options: |
---|
410 | -c --config path to configuration file (default: %s) |
---|
411 | -d --debug enable debug messages |
---|
412 | -h --help this help |
---|
413 | -H --host set the tcp host, supports IPv4 and IPv6 (default: %s) |
---|
414 | -l --log set the log file in background mode (default: none) |
---|
415 | -n --nofork don't run as daemon in the background |
---|
416 | -p --port set the tcp port (default: %s) |
---|
417 | -v --version display version information""" % (self.cfgpath, self.host, self.port) |
---|
418 | sys.exit(ret) |
---|
419 | |
---|
420 | def serverloop(options, skype): |
---|
421 | timeout = 1; # in seconds |
---|
422 | skype_ping_period = 5 |
---|
423 | bitlbee_ping_period = 10 |
---|
424 | bitlbee_pong_timeout = 30 |
---|
425 | now = time.time() |
---|
426 | skype_ping_start_time = now |
---|
427 | bitlbee_ping_start_time = now |
---|
428 | options.last_bitlbee_pong = now |
---|
429 | in_error = [] |
---|
430 | handler_ok = True |
---|
431 | while (len(in_error) == 0) and handler_ok and options.conn: |
---|
432 | ready_to_read, ready_to_write, in_error = \ |
---|
433 | select.select([options.conn], [], [options.conn], \ |
---|
434 | timeout) |
---|
435 | now = time.time() |
---|
436 | handler_ok = len(in_error) == 0 |
---|
437 | if (len(ready_to_read) == 1) and handler_ok: |
---|
438 | handler_ok = input_handler(ready_to_read.pop()) |
---|
439 | # don't ping bitlbee/skype if they already received data |
---|
440 | now = time.time() # allow for the input_handler to take some time |
---|
441 | bitlbee_ping_start_time = now |
---|
442 | skype_ping_start_time = now |
---|
443 | options.last_bitlbee_pong = now |
---|
444 | if (now - skype_ping_period > skype_ping_start_time) and handler_ok: |
---|
445 | handler_ok = skype_idle_handler(skype) |
---|
446 | skype_ping_start_time = now |
---|
447 | if now - bitlbee_ping_period > bitlbee_ping_start_time: |
---|
448 | handler_ok = bitlbee_idle_handler(skype) |
---|
449 | bitlbee_ping_start_time = now |
---|
450 | if options.last_bitlbee_pong: |
---|
451 | if (now - options.last_bitlbee_pong) > bitlbee_pong_timeout: |
---|
452 | dprint("Bitlbee pong timeout") |
---|
453 | # TODO is following line necessary? Should there be a options.conn.unwrap() somewhere? |
---|
454 | # options.conn.shutdown() |
---|
455 | if options.conn: |
---|
456 | options.conn.close() |
---|
457 | options.conn = False |
---|
458 | else: |
---|
459 | options.last_bitlbee_pong = now |
---|
460 | |
---|
461 | if __name__=='__main__': |
---|
462 | options = Options() |
---|
463 | try: |
---|
464 | opts, args = getopt.getopt(sys.argv[1:], "c:dhH:l:m:np:v", ["config=", "debug", "help", "host=", "log=", "mock=", "nofork", "port=", "version"]) |
---|
465 | except getopt.GetoptError: |
---|
466 | options.usage(1) |
---|
467 | for opt, arg in opts: |
---|
468 | if opt in ("-c", "--config"): |
---|
469 | options.cfgpath = arg |
---|
470 | elif opt in ("-d", "--debug"): |
---|
471 | options.debug = True |
---|
472 | elif opt in ("-h", "--help"): |
---|
473 | options.help = True |
---|
474 | elif opt in ("-H", "--host"): |
---|
475 | options.host = arg |
---|
476 | elif opt in ("-l", "--log"): |
---|
477 | options.log = arg |
---|
478 | elif opt in ("-m", "--mock"): |
---|
479 | options.mock = arg |
---|
480 | elif opt in ("-n", "--nofork"): |
---|
481 | options.daemon = False |
---|
482 | elif opt in ("-p", "--port"): |
---|
483 | options.port = int(arg) |
---|
484 | elif opt in ("-v", "--version"): |
---|
485 | options.version = True |
---|
486 | if options.help: |
---|
487 | options.usage(0) |
---|
488 | elif options.version: |
---|
489 | print "skyped %s" % __version__ |
---|
490 | sys.exit(0) |
---|
491 | # parse our config |
---|
492 | if not os.path.exists(options.cfgpath): |
---|
493 | print "Can't find configuration file at '%s'." % options.cfgpath |
---|
494 | print "Use the -c option to specify an alternate one." |
---|
495 | sys.exit(1) |
---|
496 | options.config = ConfigParser() |
---|
497 | options.config.read(options.cfgpath) |
---|
498 | options.config.username = options.config.get('skyped', 'username').split('#')[0] |
---|
499 | options.config.password = options.config.get('skyped', 'password').split('#')[0] |
---|
500 | options.config.sslkey = os.path.expanduser(options.config.get('skyped', 'key').split('#')[0]) |
---|
501 | options.config.sslcert = os.path.expanduser(options.config.get('skyped', 'cert').split('#')[0]) |
---|
502 | # hack: we have to parse the parameters first to locate the |
---|
503 | # config file but the -p option should overwrite the value from |
---|
504 | # the config file |
---|
505 | try: |
---|
506 | options.config.port = int(options.config.get('skyped', 'port').split('#')[0]) |
---|
507 | if not options.port: |
---|
508 | options.port = options.config.port |
---|
509 | except NoOptionError: |
---|
510 | pass |
---|
511 | if not options.port: |
---|
512 | options.port = 2727 |
---|
513 | dprint("Parsing config file '%s' done, username is '%s'." % (options.cfgpath, options.config.username)) |
---|
514 | if options.daemon: |
---|
515 | pid = os.fork() |
---|
516 | if pid == 0: |
---|
517 | nullin = file(os.devnull, 'r') |
---|
518 | nullout = file(os.devnull, 'w') |
---|
519 | os.dup2(nullin.fileno(), sys.stdin.fileno()) |
---|
520 | os.dup2(nullout.fileno(), sys.stdout.fileno()) |
---|
521 | os.dup2(nullout.fileno(), sys.stderr.fileno()) |
---|
522 | else: |
---|
523 | print 'skyped is started on port %s, pid: %d' % (options.port, pid) |
---|
524 | sys.exit(0) |
---|
525 | else: |
---|
526 | dprint('skyped is started on port %s' % options.port) |
---|
527 | if hasgobject: |
---|
528 | server(options.host, options.port) |
---|
529 | try: |
---|
530 | skype = SkypeApi(options.mock) |
---|
531 | except Skype4Py.SkypeAPIError, s: |
---|
532 | sys.exit("%s. Are you sure you have started Skype?" % s) |
---|
533 | if hasgobject: |
---|
534 | gobject.timeout_add(2000, skype_idle_handler, skype) |
---|
535 | gobject.timeout_add(60000, bitlbee_idle_handler, skype) |
---|
536 | gobject.MainLoop().run() |
---|
537 | else: |
---|
538 | while 1: |
---|
539 | options.conn = False |
---|
540 | options.lock = threading.Lock() |
---|
541 | server(options.host, options.port, skype) |
---|