summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config.py5
-rw-r--r--src/gui.py26
-rw-r--r--src/multiuserchat.py9
-rw-r--r--src/poezio.cfg7
4 files changed, 37 insertions, 10 deletions
diff --git a/src/config.py b/src/config.py
index 95f85c98..302716f6 100644
--- a/src/config.py
+++ b/src/config.py
@@ -48,9 +48,6 @@ class Config(RawConfigParser):
else:
res = self.getstr(option)
except NoOptionError:
- # TODO
- # logger.info('No value found in config file "%s" from option [%s]. Defaulting to "%s"' \
- # % (self.file_name, option, default))
return default
return res
@@ -73,7 +70,7 @@ class Config(RawConfigParser):
RawConfigParser.set(self, self.defsection, option, value)
def save(self):
- f = copen(self.filename, "w", "utf-8", "ignore")
+ f = open(self.file_name, "w")
RawConfigParser.write(self, f)
f.close()
diff --git a/src/gui.py b/src/gui.py
index 90211a9a..0950daa5 100644
--- a/src/gui.py
+++ b/src/gui.py
@@ -163,7 +163,7 @@ class Gui(object):
self.commands = {
'help': (self.command_help, 'OLOL, this is SOOO recursive'),
- 'join': (self.command_join, 'Usage: /join [room_name][/nick]\nJoin: Join the specified room. You can specify a nickname after a slash (/). If no nickname is specified you will use the default_nick in the configuration file. You can omit the room name: you will then join the room you\'re looking at (useful if you were kicked). Examples:\n/join room@server.tld\n/join room@server.tld/John\n/join /me_again\n/join'),
+ 'join': (self.command_join, 'Usage: /join [room_name][/nick]\nJoin: Join the specified room. You can specify a nickname after a slash (/). If no nickname is specified, you will use the default_nick in the configuration file. You can omit the room name: you will then join the room you\'re looking at (useful if you were kicked). Examples:\n/join room@server.tld\n/join room@server.tld/John\n/join /me_again\n/join'),
'quit': (self.command_quit, 'Usage: /quit\nQuit: Just disconnect from the server and exit poezio.'),
'exit': (self.command_quit, 'Usage: /exit\nExit: Just disconnect from the server and exit poezio.'),
'next': (self.rotate_rooms_left, 'Usage: /next\nNext: Go to the next room.'),
@@ -174,6 +174,7 @@ class Gui(object):
'busy': (self.command_busy, 'Usage: /busy [message]\nBusy: Sets your availability to busy and (optional) sets your status message. This is equivalent do "/show busy [message]"'),
'avail': (self.command_avail, 'Usage: /avail [message]\nAvail: Sets your availability to available and (optional) sets your status message. This is equivalent do "/show available [message]"'),
'available': (self.command_avail, 'Usage: /available [message]\nAvailable: Sets your availability to available and (optional) sets your status message. This is equivalent do "/show available [message]"'),
+ 'bookmark': (self.command_bookmark, 'Usage: /bookmark [roomname][/nick]\nBookmark: Bookmark the specified room (you will then auto-join it on each poezio start). This commands uses the same syntaxe as /nick. Type /help nick for syntaxe examples. Note that when typing "/bookmark" on its own, the room will be bookmarked with the nickname you\'re currently using in this room (instead of default_nick)'),
'nick': (self.command_nick, 'Usage: /nick <nickname>\nNick: Change your nickname in the current room')
}
@@ -263,7 +264,7 @@ class Gui(object):
def on_connected(self, jid):
self.information("Welcome on Poezio \o/ !")
self.information("Your JID is %s" % jid)
- pass
+ fd.close()
def join_room(self, room, nick):
self.window.text_win.new_win(room)
@@ -394,6 +395,27 @@ class Gui(object):
if not r: # if the room window exists, we don't recreate it.
self.join_room(room, nick)
+ def command_bookmark(self, args):
+ bookmarked = config.get('rooms', '')
+ nick = None
+ if len(args) == 0:
+ room = self.current_room()
+ if room.name == 'Info':
+ return
+ roomname = room.name
+ if room.joined:
+ nick = room.own_nick
+ else:
+ info = args[0].split('/')
+ if len(info) == 2:
+ nick = info[1]
+ roomname = info[0]
+ if nick:
+ res = roomname+'/'+nick
+ else:
+ res = roomname
+ config.setAndSave('rooms', bookmarked+':'+res)
+
def command_show(self, args):
possible_show = {'avail':'None',
'available':'None',
diff --git a/src/multiuserchat.py b/src/multiuserchat.py
index 3327b140..e0f202c1 100644
--- a/src/multiuserchat.py
+++ b/src/multiuserchat.py
@@ -55,7 +55,14 @@ class MultiUserChat(object):
else:
rooms = rooms.split(':')
for room in rooms:
- [roomname, nick] = room.split('/')
+ args = room.split('/')
+ if args[0] == '':
+ return
+ roomname = args[0]
+ if len(args) == 2:
+ nick = args[1]
+ else:
+ nick = config.get('default_nick', 'poezio')
self.handler.emit('join-room', room=roomname, nick=nick)
def send_message(self, room, message):
diff --git a/src/poezio.cfg b/src/poezio.cfg
index 0045618c..1abd41ac 100644
--- a/src/poezio.cfg
+++ b/src/poezio.cfg
@@ -1,7 +1,8 @@
[Poezio]
-logfile = logs
resource = poezio
+default_nick = louiz_on_poezio
server = louiz.org
+rooms = test@chat.jabberfr.org:discussion@kikoo.louiz.org:fion@kikoo.louiz.org/FION:teub@kikoo.louiz.org
+logfile = logs
port = 5222
-rooms = test@chat.jabberfr.org/poefion:discussion@kikoo.louiz.org/poezio
-default_nick = poezio
+