Adapt the startup to the new bookmarks system

This commit is contained in:
mathieui 2011-11-26 23:27:42 +01:00
parent 4ce8721c3d
commit d2726c8892

View file

@ -39,6 +39,7 @@ import pubsub
import windows import windows
import connection import connection
import timed_events import timed_events
import bookmark
from plugin_manager import PluginManager from plugin_manager import PluginManager
@ -569,23 +570,15 @@ class Core(object):
pres = self.xmpp.make_presence() pres = self.xmpp.make_presence()
self.events.trigger('send_normal_presence', pres) self.events.trigger('send_normal_presence', pres)
pres.send() pres.send()
rooms = config.get('rooms', '') bookmark.get_local()
if rooms == '' or not isinstance(rooms, str): if not self.xmpp.anon:
return bookmark.get_remote(self.xmpp)
rooms = rooms.split(':') for bm in [item for item in bookmark.bookmarks if item.autojoin]:
for room in rooms: tab = self.get_tab_by_name(bm.jid, tabs.MucTab)
jid = JID(room)
if jid.bare == '':
return
if jid.resource != '':
nick = jid.resource
else:
default = os.environ.get('USER') if os.environ.get('USER') else 'poezio'
nick = config.get('default_nick', '') or default
tab = self.get_tab_by_name(jid.bare, tabs.MucTab)
if not tab: if not tab:
self.open_new_room(jid.bare, nick, False) self.open_new_room(bm.jid, bm.nick, False)
muc.join_groupchat(self.xmpp, jid.bare, nick) nick = bm.nick if bm.nick else self.own_nick
muc.join_groupchat(self.xmpp, bm.jid, nick)
def on_groupchat_presence(self, presence): def on_groupchat_presence(self, presence):
""" """