diff options
-rw-r--r-- | data/default_config.cfg | 12 | ||||
-rw-r--r-- | doc/en/configure.txt | 14 | ||||
-rw-r--r-- | src/core.py | 18 |
3 files changed, 41 insertions, 3 deletions
diff --git a/data/default_config.cfg b/data/default_config.cfg index 284f1311..abeab2ac 100644 --- a/data/default_config.cfg +++ b/data/default_config.cfg @@ -60,6 +60,18 @@ jid = # If you leave this empty, the password will be asked at each startup password = +# The status (show) poezio will send when connecting. +# can be: xa,dnd,away,available,chat. +# An empty or invalid value will mean available. +status = + +# The status message you will have upon connection +status_message = + +# Save the last used status in this file (in the status and status_message +# options) +save_status = true + # A custom host that will be used instead of the DNS records for the server # (anonymous or the jid’s) defined above. # You should not need this in a "normal" use case. diff --git a/doc/en/configure.txt b/doc/en/configure.txt index 609775e3..fb8917e2 100644 --- a/doc/en/configure.txt +++ b/doc/en/configure.txt @@ -321,6 +321,10 @@ section of this documentation. separated by colons (":"). If there are more than 3 or 4 chained sorting methods, your sorting is most likely inefficient. +*save_status*:: true + + Save the status automatically in the status and status_message options. + *send_chat_states*:: true if true, chat states will be sent to the people you are talking to. @@ -391,6 +395,16 @@ section of this documentation. Whether or not to display a timestamp before each message. +*status*:: [empty] + + The status (show) poezio will send when connecting. It can be available, + dnd,chat, xa or away. + Nothing or an invalid value will mean available. + +*status_message*:: [empty] + + The status message poezio will send when connecting. + *use_bookmark_method*:: [empty] the method that poezio will use to store your bookmarks online. 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 ### |