This commit is contained in:
louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 2010-01-31 04:08:47 +00:00
parent 0864c6e285
commit 6f34406477
2 changed files with 6 additions and 7 deletions

View file

@ -83,12 +83,8 @@ class Room(object):
return info.encode('utf-8') return info.encode('utf-8')
def get_user_by_name(self, nick): def get_user_by_name(self, nick):
fd = open('fion', 'w')
fd.write(nick)
# fd.write('Looking for %s\n' % nick)
for user in self.users: for user in self.users:
# fd.write(user.nick) if user.nick == nick.encode('utf-8'):
if user.nick == nick:
return user return user
return None return None
@ -103,10 +99,13 @@ class Room(object):
self.users.append(User(nick, affiliation, show, status, role)) self.users.append(User(nick, affiliation, show, status, role))
if nick.encode('utf-8') == self.own_nick: if nick.encode('utf-8') == self.own_nick:
self.joined = True self.joined = True
return self.add_info("Your nickname is %s" % (nick))
return self.add_info("%s is in the room" % (nick)) return self.add_info("%s is in the room" % (nick))
change_nick = stanza.getStatusCode() == '303' change_nick = stanza.getStatusCode() == '303'
kick = stanza.getStatusCode() == '307' kick = stanza.getStatusCode() == '307'
user = self.get_user_by_name(nick) user = self.get_user_by_name(nick)
if change_nick and not user:
return self.add_info('WTF: change nick for %s but user unknown'% nick)
# New user # New user
if not user: if not user:
self.users.append(User(nick, affiliation, show, status, role)) self.users.append(User(nick, affiliation, show, status, role))

View file

@ -2,7 +2,7 @@
resource = poezio resource = poezio
default_nick = louiz_on_poezio default_nick = louiz_on_poezio
server = louiz.org server = louiz.org
rooms = test@chat.jabberfr.org:discussion@kikoo.louiz.org:fion@kikoo.louiz.org/FION:teub@kikoo.louiz.org rooms = test@chat.jabberfr.org:discussion@kikoo.louiz.org
logfile = logs logfile = logs
port = 5222 port = 5222