From d0a8304e5584ac925c858510a4005c4d5e9168cf Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 2 Jan 2013 19:07:36 +0100 Subject: 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 --- src/core.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/core.py') 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 ### -- cgit v1.2.3