summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-06-30 09:56:03 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-06-30 09:56:03 +0000
commitcf88579ec74a90c6dfb1f456800119a757f936b7 (patch)
treee6c9ba71f3092c3d1dc59d2db361ebb1179ddc91
parent39b0075679ebf0a6c9dc2333c8f9bd08bfabbdcf (diff)
downloadpoezio-cf88579ec74a90c6dfb1f456800119a757f936b7.tar.gz
poezio-cf88579ec74a90c6dfb1f456800119a757f936b7.tar.bz2
poezio-cf88579ec74a90c6dfb1f456800119a757f936b7.tar.xz
poezio-cf88579ec74a90c6dfb1f456800119a757f936b7.zip
Use louiz for the default nick, fixed #1535
-rw-r--r--data/default_config.cfg3
-rw-r--r--src/gui.py6
-rw-r--r--src/multiuserchat.py6
-rw-r--r--src/user.py4
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: