diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui.py | 6 | ||||
-rw-r--r-- | src/multiuserchat.py | 6 | ||||
-rw-r--r-- | src/user.py | 4 |
3 files changed, 12 insertions, 4 deletions
@@ -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: |