Use louiz for the default nick, fixed #1535

This commit is contained in:
louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 2010-06-30 09:56:03 +00:00
parent 39b0075679
commit cf88579ec7
4 changed files with 14 additions and 5 deletions

View file

@ -14,7 +14,8 @@ port = 5222
resource = poezio resource = poezio
# the nick you will use when joining a room with no associated nick # 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 # 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, # account on a server. This is optional and useful only for some features,

View file

@ -24,6 +24,7 @@ from os.path import isfile
from time import sleep from time import sleep
import sys import sys
import os
import curses import curses
from datetime import datetime from datetime import datetime
@ -584,7 +585,10 @@ class Gui(object):
else: else:
info = args[0].split('/') info = args[0].split('/')
if len(info) == 1: 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: else:
nick = info[1] nick = info[1]
if info[0] == '': # happens with /join /nickname, which is OK if info[0] == '': # happens with /join /nickname, which is OK

View file

@ -22,6 +22,7 @@ from xmpp.protocol import Presence, Iq, Message, JID
import xmpp import xmpp
import common import common
import threading import threading
import os
from time import (altzone, gmtime, localtime, strftime, timezone) from time import (altzone, gmtime, localtime, strftime, timezone)
@ -135,7 +136,10 @@ class MultiUserChat(object):
if len(args) == 2: if len(args) == 2:
nick = args[1] nick = args[1]
else: 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) self.handler.emit('join-room', room=roomname, nick=nick)
if config.get('jid', '') == '': # Don't send the vcard if we're not anonymous 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 self.vcard_sender.start() # because the user ALREADY has one on the server

View file

@ -29,7 +29,7 @@ class User(object):
self.last_talked = None self.last_talked = None
self.update(affiliation, show, status, role) self.update(affiliation, show, status, role)
self.change_nick(nick) 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): def update(self, affiliation, show, status, role):
self.affiliation = affiliation self.affiliation = affiliation
@ -48,7 +48,7 @@ class User(object):
def has_talked_since(self, t): def has_talked_since(self, t):
""" """
get a int t: int
Return True if the user talked since the last s seconds Return True if the user talked since the last s seconds
""" """
if self.last_talked is None: if self.last_talked is None: