summaryrefslogtreecommitdiff
path: root/src/core.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2013-01-02 19:07:36 +0100
committermathieui <mathieui@mathieui.net>2013-01-02 19:07:36 +0100
commitd0a8304e5584ac925c858510a4005c4d5e9168cf (patch)
tree5c992441e44afe0e53dba06752cfc98a12c29d08 /src/core.py
parentc04fbadf2f6c9449719096cbad152f29eaa2f042 (diff)
downloadpoezio-d0a8304e5584ac925c858510a4005c4d5e9168cf.tar.gz
poezio-d0a8304e5584ac925c858510a4005c4d5e9168cf.tar.bz2
poezio-d0a8304e5584ac925c858510a4005c4d5e9168cf.tar.xz
poezio-d0a8304e5584ac925c858510a4005c4d5e9168cf.zip
Add the save_status, status, and status_message options
(the name show is not intuitive, so I used status and status_message) - The status is send when connecting, and is the same used when joining rooms - save_status is true by default, and will make poezio save the status whenever it changes - status and status_message are empty by default
Diffstat (limited to 'src/core.py')
-rw-r--r--src/core.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/core.py b/src/core.py
index 1ac0fe7f..cfe92189 100644
--- a/src/core.py
+++ b/src/core.py
@@ -113,7 +113,10 @@ class Core(object):
# of being displayed on the screen and exiting the program.
sys.excepthook = self.on_exception
self.connection_time = time.time()
- self.status = Status(show=None, message='')
+ status = config.get('status', None)
+ status = possible_show.get(status, None)
+ self.status = Status(show=status,
+ message=config.get('status_message', ''))
self.running = True
self.xmpp = singleton.Singleton(connection.Connection)
self.xmpp.core = self
@@ -600,6 +603,9 @@ class Core(object):
or to use it when joining a new muc)
"""
self.status = Status(show=pres, message=msg)
+ if config.get('save_status', 'true').lower() != 'false':
+ config.set_and_save('status', pres if pres else '')
+ config.set_and_save('status_message', msg.replace('\n', '|') if msg else '')
def get_bookmark_nickname(self, room_name):
"""
@@ -2773,8 +2779,10 @@ class Core(object):
# request the roster
self.xmpp.get_roster()
# send initial presence
- if config.get('send_initial_presence', 'true').lower() == 'true':
+ if config.get('send_initial_presence', 'true').lower() != 'false':
pres = self.xmpp.make_presence()
+ pres['show'] = self.status.show
+ pres['status'] = self.status.message
self.events.trigger('send_normal_presence', pres)
pres.send()
bookmark.get_local()
@@ -2791,7 +2799,11 @@ class Core(object):
histo_length= None
if histo_length is not None:
histo_length= str(histo_length)
- muc.join_groupchat(self.xmpp, bm.jid, nick, bm.password, histo_length)
+ muc.join_groupchat(self.xmpp, bm.jid, nick,
+ passwd=bm.password,
+ maxhistory=histo_length,
+ status=self.status.message,
+ show=self.status.show)
### Other handlers ###