Verified Commit 5a5d5812 authored by mathieui's avatar mathieui

Add an open_all_bookmarks option

this option determines if the non-autojoin bookmarks will
be opened on startup or not.

It is false by default.
parent 6c62f624
...@@ -116,9 +116,12 @@ use_bookmarks_method = ...@@ -116,9 +116,12 @@ use_bookmarks_method =
# use this option to force the use of local bookmarks # use this option to force the use of local bookmarks
# possible values are: anything/false # possible values are: anything/false
use_remote_bookmarks = true use_remote_bookmarks = true
# Whether you want all bookmarks, even those without
# autojoin, to be open on startup
open_all_bookmarks = false
# What will be put after the name, when using autocompletion at the # What will be put after the name, when using autocompletion at the
# beginning of the input. A space will always be added after that # beginning of the input. A space will always be added after that
after_completion = , after_completion = ,
......
...@@ -197,6 +197,13 @@ Options related to account configuration, nickname… ...@@ -197,6 +197,13 @@ Options related to account configuration, nickname…
The status message poezio will send when connecting. The status message poezio will send when connecting.
open_all_bookmarks
**Default value:** ``false``
If this option is set to ``true``, all remote bookmarks, even
those that do not have autojoin, will be opened on startup.
(the tabs without autojoin will not be joined)
......
...@@ -869,24 +869,25 @@ def on_session_start(self, event): ...@@ -869,24 +869,25 @@ def on_session_start(self, event):
if not self.xmpp.anon and config.get('use_remote_bookmarks', True): if not self.xmpp.anon and config.get('use_remote_bookmarks', True):
bookmark.get_remote(self.xmpp) bookmark.get_remote(self.xmpp)
for bm in bookmark.bookmarks: for bm in bookmark.bookmarks:
tab = self.get_tab_by_name(bm.jid, tabs.MucTab) if bm.autojoin or config.get('open_all_bookmarks', False):
nick = bm.nick if bm.nick else self.own_nick tab = self.get_tab_by_name(bm.jid, tabs.MucTab)
if not tab: nick = bm.nick if bm.nick else self.own_nick
self.open_new_room(bm.jid, nick, False) if not tab:
self.initial_joins.append(bm.jid) self.open_new_room(bm.jid, nick, False)
histo_length = config.get('muc_history_length', 20) self.initial_joins.append(bm.jid)
if histo_length == -1: histo_length = config.get('muc_history_length', 20)
histo_length = None if histo_length == -1:
if histo_length is not None: histo_length = None
histo_length = str(histo_length) if histo_length is not None:
# do not join rooms that do not have autojoin histo_length = str(histo_length)
# but display them anyway # do not join rooms that do not have autojoin
if bm.autojoin: # but display them anyway
muc.join_groupchat(self, bm.jid, nick, if bm.autojoin:
passwd=bm.password, muc.join_groupchat(self, bm.jid, nick,
maxhistory=histo_length, passwd=bm.password,
status=self.status.message, maxhistory=histo_length,
show=self.status.show) status=self.status.message,
show=self.status.show)
if config.get('enable_user_nick', True): if config.get('enable_user_nick', True):
self.xmpp.plugin['xep_0172'].publish_nick(nick=self.own_nick, callback=dumb_callback, block=False) self.xmpp.plugin['xep_0172'].publish_nick(nick=self.own_nick, callback=dumb_callback, block=False)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment