menu for bookmarks now works
This commit is contained in:
parent
a516bbcab5
commit
665d7b8a58
|
@ -118,7 +118,7 @@ class Connection:
|
|||
'AGENT_INFO_INFO': [], 'QUIT': [], 'ACC_OK': [], 'MYVCARD': [],
|
||||
'OS_INFO': [], 'VCARD': [], 'GC_MSG': [], 'GC_SUBJECT': [],
|
||||
'GC_CONFIG': [], 'BAD_PASSPHRASE': [], 'ROSTER_INFO': [],
|
||||
'ERROR_ANSWER': [], 'BOOKMARK': [],}
|
||||
'ERROR_ANSWER': [], 'BOOKMARKS': [],}
|
||||
self.name = name
|
||||
self.connected = 0 # offline
|
||||
self.connection = None # xmpppy instance
|
||||
|
@ -546,39 +546,39 @@ class Connection:
|
|||
self.dispatch('ROSTER', roster)
|
||||
|
||||
def _PrivateCB(self, con, iq_obj):
|
||||
"""
|
||||
'''
|
||||
Private Data (JEP 048 and 049)
|
||||
"""
|
||||
gajim.log.debug("PrivateCB")
|
||||
storage = iq_obj.getTag("query").getTag("storage")
|
||||
'''
|
||||
gajim.log.debug('PrivateCB')
|
||||
storage = iq_obj.getTag('query').getTag('storage')
|
||||
try:
|
||||
ns = storage.getNamespace()
|
||||
except AttributeError:
|
||||
#Its a result for a 'set' Iq, so we don't do anything here
|
||||
return
|
||||
return
|
||||
|
||||
if ns=="storage:bookmarks":
|
||||
if ns == 'storage:bookmarks':
|
||||
#Bookmarked URLs and Conferences
|
||||
#http://www.jabber.org/jeps/jep-0048.html
|
||||
confs = storage.getTags("conference")
|
||||
urls = storage.getTags("url")
|
||||
confs = storage.getTags('conference')
|
||||
urls = storage.getTags('url')
|
||||
for conf in confs:
|
||||
bm = { 'name':conf.getAttr('name'),
|
||||
'jid':conf.getAttr('jid'),
|
||||
'autojoin':conf.getAttr('autojoin'),
|
||||
'password':conf.getTagData('password'),
|
||||
'nick':conf.getTagData('nick') }
|
||||
bm = { 'name': conf.getAttr('name'),
|
||||
'jid': conf.getAttr('jid'),
|
||||
'autojoin': conf.getAttr('autojoin'),
|
||||
'password': conf.getTagData('password'),
|
||||
'nick': conf.getTagData('nick') }
|
||||
|
||||
self.dispatch("BOOKMARK", bm)
|
||||
self.bookmarks.append(bm)
|
||||
self.dispatch('BOOKMARKS', self.bookmarks)
|
||||
|
||||
if bm['autojoin']=="1":
|
||||
jid = common.xmpp.protocol.JID(conf.getAttr("jid"))
|
||||
server = jid.getDomain()
|
||||
room = jid.getNode()
|
||||
gc = self.join_gc(bm['nick'], room, server, bm['password'])
|
||||
|
||||
elif ns=="gajim:prefs":
|
||||
# if bm['autojoin'] == '1':
|
||||
# jid = common.xmpp.protocol.JID(conf.getAttr('jid'))
|
||||
# server = jid.getDomain()
|
||||
# room = jid.getNode()
|
||||
# gc = self.join_gc(bm['nick'], room, server, bm['password'])
|
||||
|
||||
elif ns == 'gajim:prefs':
|
||||
#Preferences data
|
||||
#http://www.jabber.org/jeps/jep-0049.html
|
||||
#TODO: implement this
|
||||
|
|
18
src/gajim.py
18
src/gajim.py
|
@ -572,13 +572,19 @@ class Interface:
|
|||
user.groups = array[4]
|
||||
self.roster.draw_contact(jid, account)
|
||||
|
||||
def handle_event_bookmark(self, account, bm):
|
||||
#('BOOKMARK', account, {name,jid,autojoin,password,nick})
|
||||
def handle_event_bookmarks(self, account, bms):
|
||||
#('BOOKMARKS', account, [{name,jid,autojoin,password,nick}, {}])
|
||||
#We received a bookmark item from the server (JEP48)
|
||||
|
||||
#Open GC window if neccessary
|
||||
if bm['autojoin'] == '1':
|
||||
self.roster.join_gc_room(account, bm)
|
||||
#Auto join GC windows if neccessary
|
||||
for bm in bms:
|
||||
if bm['autojoin'] == '1':
|
||||
self.roster.join_gc_room(account, bm)
|
||||
room, server = bm['jid'].split('@')
|
||||
gajim.connections[account].join_gc(bm['nick'], room, server,
|
||||
bm['password'])
|
||||
self.roster.make_menu()
|
||||
|
||||
|
||||
def read_sleepy(self):
|
||||
'''Check if we are idle'''
|
||||
|
@ -742,7 +748,7 @@ class Interface:
|
|||
conn.register_handler('GC_CONFIG', self.handle_event_gc_config)
|
||||
conn.register_handler('BAD_PASSPHRASE', self.handle_event_bad_passphrase)
|
||||
conn.register_handler('ROSTER_INFO', self.handle_event_roster_info)
|
||||
conn.register_handler('BOOKMARK', self.handle_event_bookmark)
|
||||
conn.register_handler('BOOKMARKS', self.handle_event_bookmarks)
|
||||
|
||||
def process_connections(self):
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue