From cf88579ec74a90c6dfb1f456800119a757f936b7 Mon Sep 17 00:00:00 2001 From: "louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13" Date: Wed, 30 Jun 2010 09:56:03 +0000 Subject: Use louiz for the default nick, fixed #1535 --- data/default_config.cfg | 3 ++- src/gui.py | 6 +++++- src/multiuserchat.py | 6 +++++- src/user.py | 4 ++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/data/default_config.cfg b/data/default_config.cfg index 59d0917f..8de84037 100644 --- a/data/default_config.cfg +++ b/data/default_config.cfg @@ -14,7 +14,8 @@ port = 5222 resource = poezio # the nick you will use when joining a room with no associated nick -default_nick = poezio +# If this is empty, the $USER variable will be used +default_nick = # Jabber identifiant. Specify it only if you want to connect using an existing # account on a server. This is optional and useful only for some features, diff --git a/src/gui.py b/src/gui.py index e51f9828..cb1e7fc2 100644 --- a/src/gui.py +++ b/src/gui.py @@ -24,6 +24,7 @@ from os.path import isfile from time import sleep import sys +import os import curses from datetime import datetime @@ -584,7 +585,10 @@ class Gui(object): else: info = args[0].split('/') if len(info) == 1: - nick = config.get('default_nick', 'Poezio') + default = os.environ.get('USER') if os.environ.get('USER') else 'poezio' + nick = config.get('default_nick', '') + if nick == '': + nick = default else: nick = info[1] if info[0] == '': # happens with /join /nickname, which is OK diff --git a/src/multiuserchat.py b/src/multiuserchat.py index cd004709..0ac52725 100644 --- a/src/multiuserchat.py +++ b/src/multiuserchat.py @@ -22,6 +22,7 @@ from xmpp.protocol import Presence, Iq, Message, JID import xmpp import common import threading +import os from time import (altzone, gmtime, localtime, strftime, timezone) @@ -135,7 +136,10 @@ class MultiUserChat(object): if len(args) == 2: nick = args[1] else: - nick = config.get('default_nick', 'poezio') + default = os.environ.get('USER') if os.environ.get('USER') else 'poezio' + nick = config.get('default_nick', '') + if nick == '': + nick = default self.handler.emit('join-room', room=roomname, nick=nick) if config.get('jid', '') == '': # Don't send the vcard if we're not anonymous self.vcard_sender.start() # because the user ALREADY has one on the server diff --git a/src/user.py b/src/user.py index 8ec76ba4..da403b51 100644 --- a/src/user.py +++ b/src/user.py @@ -29,7 +29,7 @@ class User(object): self.last_talked = None self.update(affiliation, show, status, role) self.change_nick(nick) - self.color = randrange(2, 10) + self.color = randrange(2, 10) # assign a random color def update(self, affiliation, show, status, role): self.affiliation = affiliation @@ -48,7 +48,7 @@ class User(object): def has_talked_since(self, t): """ - get a int + t: int Return True if the user talked since the last s seconds """ if self.last_talked is None: -- cgit v1.2.3