X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=lib%2Fpython%2Fdolcon%2F__init__.py;h=c007e0123b4b67a2fc1e4077e4be8c9a001ac7e0;hb=2ce95e0eff284afcecc86359b2d585b657c26d5a;hp=c1611ac590f1da39586bcb707fa927736458b2de;hpb=9cbeb60c78389bde5a290e263335cffffbb5ced6;p=doldaconnect.git diff --git a/lib/python/dolcon/__init__.py b/lib/python/dolcon/__init__.py index c1611ac..c007e01 100644 --- a/lib/python/dolcon/__init__.py +++ b/lib/python/dolcon/__init__.py @@ -1,3 +1,20 @@ +# Dolda Connect - Modular multiuser Direct Connect-style client +# Copyright (C) 2007 Fredrik Tolf +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + from dolmod import * import os @@ -33,7 +50,10 @@ def mustconnect(host, revision = latest): any of these steps fail, an exception is raised. If successful, the file descriptor for the server connection is returned. """ - fd = connect(host) + if host is None: + fd = connect() + else: + fd = connect(host) while True: resp = getresp() if resp is not None and resp.getcmd() == u".connect": @@ -48,15 +68,10 @@ def mustconnect(host, revision = latest): def cnl(host = None, useauthless = True, revision = latest, **kw): """A convenience function for connect and loginasync. - This function will connect to the given server, or the server in - the environment variable $DCSERVER if none is given, or, if that - fails, localhost, and authenticate to the server. If any of the - steps fail, an exception is raised. + This function will connect to the given server, or try the default + servers if none given, and authenticate to the server. If any of + the steps fail, an exception is raised. """ - if host is None: - host = os.getenv("DCSERVER") - if host is None: - host = "localhost" fd = mustconnect(host, revision) err, reason = login(useauthless, **kw) if err != "success":