summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-01-30 02:50:24 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-01-30 02:50:24 +0000
commit95c7ad4ac82762e3e017cd8ef85d267add803126 (patch)
treee98d55b51030718874810c5e70f08b5dbfc2559d /src
parent33cf82e0947be35bf4e4666d0db632b60e5c27f9 (diff)
downloadpoezio-95c7ad4ac82762e3e017cd8ef85d267add803126.tar.gz
poezio-95c7ad4ac82762e3e017cd8ef85d267add803126.tar.bz2
poezio-95c7ad4ac82762e3e017cd8ef85d267add803126.tar.xz
poezio-95c7ad4ac82762e3e017cd8ef85d267add803126.zip
on peut choisir son nick lors d'un /join machin@truc/NICK
Diffstat (limited to 'src')
-rw-r--r--src/client.py2
-rw-r--r--src/connection.py1
-rw-r--r--src/gui.py17
-rw-r--r--src/multiuserchat.py12
-rw-r--r--src/poezio.cfg6
-rw-r--r--src/window.py4
6 files changed, 27 insertions, 15 deletions
diff --git a/src/client.py b/src/client.py
index 90d08415..6ed27272 100644
--- a/src/client.py
+++ b/src/client.py
@@ -25,9 +25,9 @@ from handler import Handler
from gui import Gui
from curses import wrapper, initscr
+sys.stderr = open('logs', 'a')
if len(sys.argv) == 1: # not debug, so hide any error message and disable C-c
import signal
- sys.stderr = open('logs', 'a')
signal.signal(signal.SIGINT, signal.SIG_IGN)
class Client(object):
diff --git a/src/connection.py b/src/connection.py
index ec5a2d9d..0dae9cc7 100644
--- a/src/connection.py
+++ b/src/connection.py
@@ -98,7 +98,6 @@ class Connection(Thread):
def handler_error(self, connection, error):
print "fion"
sys.exit()
-# self.handler.emit('room-iq', stanza=iq)
def process(self, timeout=10):
if self.online:
diff --git a/src/gui.py b/src/gui.py
index ddcd57d6..f749261a 100644
--- a/src/gui.py
+++ b/src/gui.py
@@ -28,6 +28,8 @@ from logging import logger
from random import randrange
+from config import config
+
locale.setlocale(locale.LC_ALL, '')
code = locale.getpreferredencoding()
@@ -292,6 +294,7 @@ class Gui(object):
def execute(self):
line = self.window.input.get_text()
self.window.input.clear_text()
+ curses.doupdate()
if line == "":
return
if line.startswith('/'):
@@ -306,13 +309,19 @@ class Gui(object):
self.window.input.refresh()
def command_join(self, args):
- room = args[0]
+ info = args[0].split('/')
+ if len(info) == 1:
+ nick = config.get('default_nick', 'Poezio')
+ else:
+ nick = info[1]
+ room = info[0]
r = self.get_room_by_name(room)
- if r: # if we are already in the room
+ if r and r.joined: # if we are already in the room
self.information("already in room [%s]" % room)
return
- self.muc.join_room(room, "poezio")
- self.join_room(room, 'poezio')
+ self.muc.join_room(room, nick)
+ if not r: # if the room window exist, we don't recreate it.
+ self.join_room(room, nick)
def information(self, msg):
room = self.get_room_by_name("Info")
diff --git a/src/multiuserchat.py b/src/multiuserchat.py
index 5f5a1ffd..6bded78e 100644
--- a/src/multiuserchat.py
+++ b/src/multiuserchat.py
@@ -64,15 +64,17 @@ class MultiUserChat(object):
mes.setType('groupchat')
self.connection.send(mes)
- def join_room(self, room, nick):
+ def join_room(self, room, nick, password=None):
"""Join a new room"""
- self.rooms.append(room)
- self.rn[room] = nick
+ # self.rooms.append(room)
+ # self.rn[room] = nick
pres = Presence(to='%s/%s' % (room, nick))
pres.setFrom('%s'%self.own_jid)
- pres.addChild(name='x', namespace=NS_MUC)
- open('fion', 'w').write(str(pres))
+ if password:
+ pres.addChild(name='x', namespace=NS_MUC)
+ else:
+ pres.addChild(name='x', namespace=NS_MUC)
self.connection.send(pres)
def quit_room(self, room, nick):
diff --git a/src/poezio.cfg b/src/poezio.cfg
index 39be1c85..0045618c 100644
--- a/src/poezio.cfg
+++ b/src/poezio.cfg
@@ -3,7 +3,5 @@ logfile = logs
resource = poezio
server = louiz.org
port = 5222
-rooms = discussion@kikoo.louiz.org/poezio:test@chat.jabberfr.org/poefion
-
-
-
+rooms = test@chat.jabberfr.org/poefion:discussion@kikoo.louiz.org/poezio
+default_nick = poezio
diff --git a/src/window.py b/src/window.py
index b7965335..5f3d2a74 100644
--- a/src/window.py
+++ b/src/window.py
@@ -185,6 +185,8 @@ class Input(Win):
self.refresh()
def key_up(self):
+ if not len(self.history):
+ return
self.win.clear()
if self.histo_pos >= 0:
self.histo_pos -= 1
@@ -194,6 +196,8 @@ class Input(Win):
self.refresh()
def key_down(self):
+ if not len(self.history):
+ return
self.win.clear()
if self.histo_pos < len(self.history)-1:
self.histo_pos += 1