Changeset d891915


Ignore:
Timestamp:
2008-05-19T18:22:03Z (16 years ago)
Author:
Miklos Vajna <vmiklos@…>
Branches:
master
Children:
9627276
Parents:
d0a6a8c
Message:

allow setting the port from the config file

Location:
skype
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • skype/skyped.conf.dist.in

    rd0a6a8c rd891915  
    55cert = @sysconfdir@/skyped/skyped.cert.pem
    66key  = @sysconfdir@/skyped/skyped.key.pem
     7port = 2727
  • skype/skyped.py

    rd0a6a8c rd891915  
    3131import Skype4Py
    3232import sha
    33 from ConfigParser import ConfigParser
     33from ConfigParser import ConfigParser, NoOptionError
    3434from traceback import print_exception
    3535
     
    183183                self.help = False
    184184                self.host = "0.0.0.0"
    185                 self.port = 2727
     185                self.port = None
    186186                self.version = False
    187187                # well, this is a bit hackish. we store the socket of the last connected client
     
    225225                        options.daemon = False
    226226                elif opt in ("-p", "--port"):
    227                         options.port = arg
     227                        options.port = int(arg)
    228228                elif opt in ("-v", "--version"):
    229229                        options.version = True
     
    244244        options.config.sslkey = options.config.get('skyped', 'key').split('#')[0]
    245245        options.config.sslcert = options.config.get('skyped', 'cert').split('#')[0]
     246        # hack: we have to parse the parameters first to locate the
     247        # config file but the -p option should overwrite the value from
     248        # the config file
     249        try:
     250                options.config.port = int(options.config.get('skyped', 'port').split('#')[0])
     251                if not options.port:
     252                        options.port = options.config.port
     253        except NoOptionError:
     254                pass
     255        if not options.port:
     256                options.port = 2727
    246257        dprint("Parsing config file '%s' done, username is '%s'." % (options.cfgpath, options.config.username))
    247258        if options.daemon:
     
    256267                        print 'skyped is started on port %s, pid: %d' % (options.port, pid)
    257268                        sys.exit(0)
     269        else:
     270                dprint('skyped is started on port %s' % options.port)
    258271        server(options.host, options.port)
    259272        try:
Note: See TracChangeset for help on using the changeset viewer.