we can now configure if we want to see all status or only enter/leave in bookmarked rooms.
This commit is contained in:
parent
5748b3c276
commit
9abd27fbf8
|
@ -838,6 +838,8 @@ class Connection(ConnectionHandlers):
|
||||||
iq5 = iq4.setTagData('nick', bm['nick'])
|
iq5 = iq4.setTagData('nick', bm['nick'])
|
||||||
if bm['password']:
|
if bm['password']:
|
||||||
iq5 = iq4.setTagData('password', bm['password'])
|
iq5 = iq4.setTagData('password', bm['password'])
|
||||||
|
if bm['show_status']:
|
||||||
|
iq5 = iq4.setTagData('show_status', bm['show_status'])
|
||||||
self.connection.send(iq)
|
self.connection.send(iq)
|
||||||
|
|
||||||
def get_metacontacts(self):
|
def get_metacontacts(self):
|
||||||
|
|
|
@ -1104,7 +1104,8 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco)
|
||||||
'jid': conf.getAttr('jid'),
|
'jid': conf.getAttr('jid'),
|
||||||
'autojoin': autojoin_val,
|
'autojoin': autojoin_val,
|
||||||
'password': conf.getTagData('password'),
|
'password': conf.getTagData('password'),
|
||||||
'nick': conf.getTagData('nick') }
|
'nick': conf.getTagData('nick'),
|
||||||
|
'show_status': conf.getTagData('show_status')}
|
||||||
|
|
||||||
self.bookmarks.append(bm)
|
self.bookmarks.append(bm)
|
||||||
self.dispatch('BOOKMARKS', self.bookmarks)
|
self.dispatch('BOOKMARKS', self.bookmarks)
|
||||||
|
|
|
@ -2224,15 +2224,15 @@ class ManageBookmarksWindow:
|
||||||
self.xml = gtkgui_helpers.get_glade('manage_bookmarks_window.glade')
|
self.xml = gtkgui_helpers.get_glade('manage_bookmarks_window.glade')
|
||||||
self.window = self.xml.get_widget('manage_bookmarks_window')
|
self.window = self.xml.get_widget('manage_bookmarks_window')
|
||||||
|
|
||||||
#Account-JID, RoomName, Room-JID, Autojoin, Passowrd, Nick
|
#Account-JID, RoomName, Room-JID, Autojoin, Passowrd, Nick, Show_Status
|
||||||
self.treestore = gtk.TreeStore(str, str, str, bool, str, str)
|
self.treestore = gtk.TreeStore(str, str, str, bool, str, str, str)
|
||||||
|
|
||||||
#Store bookmarks in treeview.
|
#Store bookmarks in treeview.
|
||||||
for account in gajim.connections:
|
for account in gajim.connections:
|
||||||
if gajim.connections[account].connected <= 1:
|
if gajim.connections[account].connected <= 1:
|
||||||
continue
|
continue
|
||||||
iter = self.treestore.append(None, [None, account,None,
|
iter = self.treestore.append(None, [None, account,None,
|
||||||
None, None, None])
|
None, None, None, None])
|
||||||
|
|
||||||
for bookmark in gajim.connections[account].bookmarks:
|
for bookmark in gajim.connections[account].bookmarks:
|
||||||
if bookmark['name'] == '':
|
if bookmark['name'] == '':
|
||||||
|
@ -2251,7 +2251,21 @@ class ManageBookmarksWindow:
|
||||||
bookmark['jid'],
|
bookmark['jid'],
|
||||||
autojoin,
|
autojoin,
|
||||||
bookmark['password'],
|
bookmark['password'],
|
||||||
bookmark['nick'] ])
|
bookmark['nick'],
|
||||||
|
bookmark['show_status'] ])
|
||||||
|
|
||||||
|
self.show_status_combobox = self.xml.get_widget('show_status_combobox')
|
||||||
|
model = gtk.ListStore(str, str)
|
||||||
|
|
||||||
|
self.option_list = {'': '', 'all': _('All'),
|
||||||
|
'in_and_out': _('Enter and leave only'), 'none': _('None')}
|
||||||
|
opts = self.option_list.keys()
|
||||||
|
opts.sort()
|
||||||
|
for opt in opts:
|
||||||
|
model.append([self.option_list[opt], opt])
|
||||||
|
|
||||||
|
self.show_status_combobox.set_model(model)
|
||||||
|
self.show_status_combobox.set_active(0)
|
||||||
|
|
||||||
self.view = self.xml.get_widget('bookmarks_treeview')
|
self.view = self.xml.get_widget('bookmarks_treeview')
|
||||||
self.view.set_model(self.treestore)
|
self.view.set_model(self.treestore)
|
||||||
|
@ -2315,7 +2329,7 @@ class ManageBookmarksWindow:
|
||||||
account = model[add_to][1].decode('utf-8')
|
account = model[add_to][1].decode('utf-8')
|
||||||
nick = gajim.nicks[account]
|
nick = gajim.nicks[account]
|
||||||
self.treestore.append(add_to, [account, _('New Room'), '', False, '',
|
self.treestore.append(add_to, [account, _('New Room'), '', False, '',
|
||||||
nick])
|
nick, 'all'])
|
||||||
|
|
||||||
self.view.expand_row(model.get_path(add_to), True)
|
self.view.expand_row(model.get_path(add_to), True)
|
||||||
|
|
||||||
|
@ -2372,7 +2386,7 @@ _('Please be sure to fill out server and room fields or remove this bookmark.'))
|
||||||
|
|
||||||
#create the bookmark-dict
|
#create the bookmark-dict
|
||||||
bmdict = { 'name': bm[1], 'jid': bm[2], 'autojoin': autojoin,
|
bmdict = { 'name': bm[1], 'jid': bm[2], 'autojoin': autojoin,
|
||||||
'password': bm[4], 'nick': bm[5] }
|
'password': bm[4], 'nick': bm[5], 'show_status': bm[6]}
|
||||||
|
|
||||||
gajim.connections[account_unicode].bookmarks.append(bmdict)
|
gajim.connections[account_unicode].bookmarks.append(bmdict)
|
||||||
|
|
||||||
|
@ -2395,7 +2409,8 @@ _('Please be sure to fill out server and room fields or remove this bookmark.'))
|
||||||
return
|
return
|
||||||
|
|
||||||
widgets = [ self.title_entry, self.nick_entry, self.room_entry,
|
widgets = [ self.title_entry, self.nick_entry, self.room_entry,
|
||||||
self.server_entry, self.pass_entry, self.autojoin_checkbutton ]
|
self.server_entry, self.pass_entry, self.autojoin_checkbutton,
|
||||||
|
self.show_status_combobox]
|
||||||
|
|
||||||
if model.iter_parent(iter):
|
if model.iter_parent(iter):
|
||||||
# make the fields sensitive
|
# make the fields sensitive
|
||||||
|
@ -2437,6 +2452,14 @@ _('Please be sure to fill out server and room fields or remove this bookmark.'))
|
||||||
else:
|
else:
|
||||||
self.nick_entry.set_text('')
|
self.nick_entry.set_text('')
|
||||||
|
|
||||||
|
show_status = model[iter][6]
|
||||||
|
opts = self.option_list.keys()
|
||||||
|
opts.sort()
|
||||||
|
if show_status:
|
||||||
|
self.show_status_combobox.set_active(opts.index(show_status))
|
||||||
|
else:
|
||||||
|
self.show_status_combobox.set_active(0)
|
||||||
|
|
||||||
def on_title_entry_changed(self, widget):
|
def on_title_entry_changed(self, widget):
|
||||||
(model, iter) = self.selection.get_selected()
|
(model, iter) = self.selection.get_selected()
|
||||||
if iter: # After removing a bookmark, we got nothing selected
|
if iter: # After removing a bookmark, we got nothing selected
|
||||||
|
@ -2473,12 +2496,21 @@ _('Please be sure to fill out server and room fields or remove this bookmark.'))
|
||||||
if iter:
|
if iter:
|
||||||
model[iter][3] = self.autojoin_checkbutton.get_active()
|
model[iter][3] = self.autojoin_checkbutton.get_active()
|
||||||
|
|
||||||
|
def on_show_status_combobox_changed(self, widget):
|
||||||
|
active = widget.get_active()
|
||||||
|
model = widget.get_model()
|
||||||
|
show_status = model[active][1]
|
||||||
|
(model2, iter) = self.selection.get_selected()
|
||||||
|
if iter:
|
||||||
|
model2[iter][6] = show_status
|
||||||
|
|
||||||
def clear_fields(self):
|
def clear_fields(self):
|
||||||
widgets = [ self.title_entry, self.nick_entry, self.room_entry,
|
widgets = [ self.title_entry, self.nick_entry, self.room_entry,
|
||||||
self.server_entry, self.pass_entry ]
|
self.server_entry, self.pass_entry ]
|
||||||
for field in widgets:
|
for field in widgets:
|
||||||
field.set_text('')
|
field.set_text('')
|
||||||
self.autojoin_checkbutton.set_active(False)
|
self.autojoin_checkbutton.set_active(False)
|
||||||
|
self.show_status_combobox.set_active(0)
|
||||||
|
|
||||||
class AccountCreationWizardWindow:
|
class AccountCreationWizardWindow:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
|
@ -531,8 +531,6 @@ class GroupchatControl(ChatControlBase):
|
||||||
# muc-specific chatstate
|
# muc-specific chatstate
|
||||||
self.parent_win.redraw_tab(self, 'newmsg')
|
self.parent_win.redraw_tab(self, 'newmsg')
|
||||||
else:
|
else:
|
||||||
if not gajim.config.get('print_status_in_muc'):
|
|
||||||
return
|
|
||||||
kind = 'status'
|
kind = 'status'
|
||||||
|
|
||||||
if kind == 'incoming': # it's a message NOT from us
|
if kind == 'incoming': # it's a message NOT from us
|
||||||
|
@ -841,15 +839,30 @@ class GroupchatControl(ChatControlBase):
|
||||||
self.parent_win.redraw_tab(self)
|
self.parent_win.redraw_tab(self)
|
||||||
if (time.time() - self.room_creation) > 30 and \
|
if (time.time() - self.room_creation) > 30 and \
|
||||||
nick != self.nick and statusCode != '303':
|
nick != self.nick and statusCode != '303':
|
||||||
if show == 'offline':
|
st = ''
|
||||||
|
found = False
|
||||||
|
for bookmark in gajim.connections[self.account].bookmarks:
|
||||||
|
if bookmark['jid'] == self.room_jid:
|
||||||
|
found = True
|
||||||
|
break
|
||||||
|
show_status = None
|
||||||
|
if found:
|
||||||
|
show_status = bookmark['show_status']
|
||||||
|
if not show_status:
|
||||||
|
if gajim.config.get('print_status_in_muc'):
|
||||||
|
show_status = 'all'
|
||||||
|
else:
|
||||||
|
show_status = 'none'
|
||||||
|
if show == 'offline' and show_status in ('all', 'in_and_out'):
|
||||||
st = _('%s has left') % nick
|
st = _('%s has left') % nick
|
||||||
if reason:
|
if reason:
|
||||||
st += ' [%s]' % reason
|
st += ' [%s]' % reason
|
||||||
else:
|
else:
|
||||||
if newly_created:
|
if newly_created and show_status in ('all', 'in_and_out'):
|
||||||
st = _('%s has joined the room') % nick
|
st = _('%s has joined the room') % nick
|
||||||
else:
|
elif show_status == 'all':
|
||||||
st = _('%s is now %s') % (nick, helpers.get_uf_show(show))
|
st = _('%s is now %s') % (nick, helpers.get_uf_show(show))
|
||||||
|
if st:
|
||||||
if status:
|
if status:
|
||||||
st += ' (' + status + ')'
|
st += ' (' + status + ')'
|
||||||
self.print_conversation(st)
|
self.print_conversation(st)
|
||||||
|
|
Loading…
Reference in New Issue