We can now see affiliation list (ban, admin, ...), edit it will come (beginning of #530)
This commit is contained in:
parent
ded0b38723
commit
864b82e9e4
4 changed files with 19124 additions and 18985 deletions
|
@ -1313,6 +1313,18 @@ class Connection:
|
||||||
dic = self.parse_data_form(node)
|
dic = self.parse_data_form(node)
|
||||||
self.dispatch('GC_CONFIG', (self.get_full_jid(iq_obj), dic))
|
self.dispatch('GC_CONFIG', (self.get_full_jid(iq_obj), dic))
|
||||||
|
|
||||||
|
def _MucAdminCB(self, con, iq_obj):
|
||||||
|
gajim.log.debug('MucAdminCB')
|
||||||
|
items = iq_obj.getTag('query', namespace = common.xmpp.NS_MUC_ADMIN).getTags('item')
|
||||||
|
list = []
|
||||||
|
affiliation = ''
|
||||||
|
for item in items:
|
||||||
|
if item.has_attr('jid') and item.has_attr('affiliation'):
|
||||||
|
affiliation = item.getAttr('affiliation')
|
||||||
|
list.append(item.getAttr('jid'))
|
||||||
|
|
||||||
|
self.dispatch('GC_AFFILIATION', (self.get_full_jid(iq_obj), affiliation, list))
|
||||||
|
|
||||||
def _MucErrorCB(self, con, iq_obj):
|
def _MucErrorCB(self, con, iq_obj):
|
||||||
gajim.log.debug('MucErrorCB')
|
gajim.log.debug('MucErrorCB')
|
||||||
jid = self.get_full_jid(iq_obj)
|
jid = self.get_full_jid(iq_obj)
|
||||||
|
@ -1740,6 +1752,8 @@ class Connection:
|
||||||
common.xmpp.NS_VERSION)
|
common.xmpp.NS_VERSION)
|
||||||
con.RegisterHandler('iq', self._MucOwnerCB, 'result',
|
con.RegisterHandler('iq', self._MucOwnerCB, 'result',
|
||||||
common.xmpp.NS_MUC_OWNER)
|
common.xmpp.NS_MUC_OWNER)
|
||||||
|
con.RegisterHandler('iq', self._MucAdminCB, 'result',
|
||||||
|
common.xmpp.NS_MUC_ADMIN)
|
||||||
con.RegisterHandler('iq', self._getRosterCB, 'result',
|
con.RegisterHandler('iq', self._getRosterCB, 'result',
|
||||||
common.xmpp.NS_ROSTER)
|
common.xmpp.NS_ROSTER)
|
||||||
con.RegisterHandler('iq', self._PrivateCB, 'result',
|
con.RegisterHandler('iq', self._PrivateCB, 'result',
|
||||||
|
@ -2333,6 +2347,25 @@ class Connection:
|
||||||
item.addChild(name = 'reason', payload = reason)
|
item.addChild(name = 'reason', payload = reason)
|
||||||
self.to_be_sent.append(iq)
|
self.to_be_sent.append(iq)
|
||||||
|
|
||||||
|
def send_gc_affiliation_list(self, room_jid, affiliation, list):
|
||||||
|
if not self.connection:
|
||||||
|
return
|
||||||
|
iq = common.xmpp.Iq(typ = 'set', to = room_jid, queryNS = \
|
||||||
|
common.xmpp.NS_MUC_ADMIN)
|
||||||
|
item = iq.getTag('query')
|
||||||
|
for jid in list:
|
||||||
|
item.addChild('item', {'jid': jid, 'affiliation': affiliation})
|
||||||
|
self.to_be_sent.append(iq)
|
||||||
|
|
||||||
|
def get_affiliation_list(self, room_jid, affiliation):
|
||||||
|
if not self.connection:
|
||||||
|
return
|
||||||
|
iq = common.xmpp.Iq(typ = 'get', to = room_jid, queryNS = \
|
||||||
|
common.xmpp.NS_MUC_ADMIN)
|
||||||
|
item = iq.getTag('query').setTag('item')
|
||||||
|
item.setAttr('affiliation', affiliation)
|
||||||
|
self.to_be_sent.append(iq)
|
||||||
|
|
||||||
def build_data_from_dict(self, query, config):
|
def build_data_from_dict(self, query, config):
|
||||||
x = query.setTag(common.xmpp.NS_DATA + ' x', attrs = {'type': 'submit'})
|
x = query.setTag(common.xmpp.NS_DATA + ' x', attrs = {'type': 'submit'})
|
||||||
i = 0
|
i = 0
|
||||||
|
|
|
@ -229,7 +229,7 @@ class PreferencesWindow:
|
||||||
self.xml.get_widget('status_msg_colorbutton').set_color(
|
self.xml.get_widget('status_msg_colorbutton').set_color(
|
||||||
gtk.gdk.color_parse(colSt))
|
gtk.gdk.color_parse(colSt))
|
||||||
|
|
||||||
#Color for hyperlinks
|
#Color for hyperlinks
|
||||||
colSt = gajim.config.get('urlmsgcolor')
|
colSt = gajim.config.get('urlmsgcolor')
|
||||||
self.xml.get_widget('url_msg_colorbutton').set_color(
|
self.xml.get_widget('url_msg_colorbutton').set_color(
|
||||||
gtk.gdk.color_parse(colSt))
|
gtk.gdk.color_parse(colSt))
|
||||||
|
@ -1092,7 +1092,7 @@ class AccountModificationWindow:
|
||||||
name = self.xml.get_widget('name_entry').get_text().decode('utf-8')
|
name = self.xml.get_widget('name_entry').get_text().decode('utf-8')
|
||||||
if gajim.connections.has_key(self.account):
|
if gajim.connections.has_key(self.account):
|
||||||
if name != self.account and \
|
if name != self.account and \
|
||||||
gajim.connections[self.account].connected != 0:
|
gajim.connections[self.account].connected != 0:
|
||||||
dialogs.ErrorDialog(_('You are currently connected to the server'),
|
dialogs.ErrorDialog(_('You are currently connected to the server'),
|
||||||
_('To change the account name, you must be disconnected.')).get_response()
|
_('To change the account name, you must be disconnected.')).get_response()
|
||||||
return
|
return
|
||||||
|
@ -1842,6 +1842,78 @@ class ServiceRegistrationWindow(DataFormWindow):
|
||||||
self.xml.signal_autoconnect(self)
|
self.xml.signal_autoconnect(self)
|
||||||
self.window.show_all()
|
self.window.show_all()
|
||||||
|
|
||||||
|
class GroupchatConfigWindow(DataFormWindow):
|
||||||
|
'''GroupchatConfigWindow class'''
|
||||||
|
def __init__(self, account, room_jid, config):
|
||||||
|
DataFormWindow.__init__(self, account, config)
|
||||||
|
self.room_jid = room_jid
|
||||||
|
|
||||||
|
# Draw the edit affiliation list things
|
||||||
|
add_on_vbox = self.xml.get_widget('add_on_vbox')
|
||||||
|
hbox = gtk.HBox(spacing = 5)
|
||||||
|
add_on_vbox.pack_start(hbox, False)
|
||||||
|
|
||||||
|
label = gtk.Label('Edit affiliation list:')
|
||||||
|
hbox.pack_start(label, False)
|
||||||
|
|
||||||
|
liststore = gtk.ListStore(str, str)
|
||||||
|
self.affiliation_combobox = gtk.ComboBox(liststore)
|
||||||
|
cell = gtk.CellRendererText()
|
||||||
|
self.affiliation_combobox.pack_start(cell, True)
|
||||||
|
self.affiliation_combobox.add_attribute(cell, 'text', 0)
|
||||||
|
liststore.append(('', ''))
|
||||||
|
liststore.append((_('Ban List'), 'outcast'))
|
||||||
|
liststore.append((_('Member List'), 'member'))
|
||||||
|
liststore.append((_('Owner List'), 'owner'))
|
||||||
|
liststore.append((_('Admin List'), 'admin'))
|
||||||
|
self.affiliation_combobox.connect('changed', self.on_affiliation_combobox_changed)
|
||||||
|
hbox.pack_start(self.affiliation_combobox, False)
|
||||||
|
|
||||||
|
liststore = gtk.ListStore(str)
|
||||||
|
self.affiliation_treeview = gtk.TreeView(liststore)
|
||||||
|
self.affiliation_treeview.set_header_visible(False)
|
||||||
|
renderer = gtk.CellRendererText()
|
||||||
|
col = gtk.TreeViewColumn(_('JID'), renderer)
|
||||||
|
col.add_attribute(renderer, 'text', 0)
|
||||||
|
self.affiliation_treeview.append_column(col)
|
||||||
|
sc = gtk.ScrolledWindow()
|
||||||
|
sc.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_NEVER)
|
||||||
|
sc.add(self.affiliation_treeview)
|
||||||
|
add_on_vbox.pack_start(sc)
|
||||||
|
|
||||||
|
add_on_vbox.show_all()
|
||||||
|
|
||||||
|
def get_active_affiliation(self):
|
||||||
|
model = self.affiliation_combobox.get_model()
|
||||||
|
active_iter = self.affiliation_combobox.get_active()
|
||||||
|
if active_iter < 0:
|
||||||
|
return None
|
||||||
|
return model[active_iter][1]
|
||||||
|
|
||||||
|
def on_affiliation_combobox_changed(self, combobox):
|
||||||
|
tv = self.affiliation_treeview
|
||||||
|
tv.get_model().clear()
|
||||||
|
|
||||||
|
affiliation = self.get_active_affiliation()
|
||||||
|
if affiliation:
|
||||||
|
gajim.connections[self.account].get_affiliation_list(self.room_jid,
|
||||||
|
affiliation)
|
||||||
|
|
||||||
|
def affiliation_list_received(self, affiliation, list):
|
||||||
|
'''Fill the affiliation treeview'''
|
||||||
|
if affiliation != self.get_active_affiliation():
|
||||||
|
return
|
||||||
|
tv = self.affiliation_treeview
|
||||||
|
model = tv.get_model()
|
||||||
|
for jid in list:
|
||||||
|
model.append((jid,))
|
||||||
|
|
||||||
|
def on_data_form_window_destroy(self, widget):
|
||||||
|
del gajim.interface.instances[self.account]['gc_config'][self.room_jid]
|
||||||
|
|
||||||
|
def on_apply_button_clicked(self, widget):
|
||||||
|
gajim.connections[self.account].send_gc_config(self.room_jid, self.config)
|
||||||
|
self.window.destroy()
|
||||||
|
|
||||||
#---------- ManageEmoticonsWindow class -------------#
|
#---------- ManageEmoticonsWindow class -------------#
|
||||||
class ManageEmoticonsWindow:
|
class ManageEmoticonsWindow:
|
||||||
|
@ -2035,19 +2107,6 @@ class ManageEmoticonsWindow:
|
||||||
if event.keyval == gtk.keysyms.Delete:
|
if event.keyval == gtk.keysyms.Delete:
|
||||||
self.on_button_remove_emoticon_clicked(widget)
|
self.on_button_remove_emoticon_clicked(widget)
|
||||||
|
|
||||||
class GroupchatConfigWindow(DataFormWindow):
|
|
||||||
'''GroupchatConfigWindow class'''
|
|
||||||
def __init__(self, account, room_jid, config):
|
|
||||||
DataFormWindow.__init__(self, account, config)
|
|
||||||
self.room_jid = room_jid
|
|
||||||
|
|
||||||
def on_data_form_window_destroy(self, widget):
|
|
||||||
del gajim.interface.instances[self.account]['gc_config'][self.room_jid]
|
|
||||||
|
|
||||||
def on_apply_button_clicked(self, widget):
|
|
||||||
gajim.connections[self.account].send_gc_config(self.room_jid, self.config)
|
|
||||||
self.window.destroy()
|
|
||||||
|
|
||||||
#---------- RemoveAccountWindow class -------------#
|
#---------- RemoveAccountWindow class -------------#
|
||||||
class RemoveAccountWindow:
|
class RemoveAccountWindow:
|
||||||
'''ask for removing from gajim only or from gajim and server too
|
'''ask for removing from gajim only or from gajim and server too
|
||||||
|
|
10
src/gajim.py
10
src/gajim.py
|
@ -785,7 +785,14 @@ class Interface:
|
||||||
if not self.instances[account]['gc_config'].has_key(jid):
|
if not self.instances[account]['gc_config'].has_key(jid):
|
||||||
self.instances[account]['gc_config'][jid] = \
|
self.instances[account]['gc_config'][jid] = \
|
||||||
config.GroupchatConfigWindow(account, jid, array[1])
|
config.GroupchatConfigWindow(account, jid, array[1])
|
||||||
|
|
||||||
|
def handle_event_gc_affiliation(self, account, array):
|
||||||
|
#('GC_AFFILIATION', account, (room_jid, affiliation, list)) list is list
|
||||||
|
room_jid = array[0]
|
||||||
|
if self.instances[account]['gc_config'].has_key(room_jid):
|
||||||
|
self.instances[account]['gc_config'][room_jid].affiliation_list_received(
|
||||||
|
array[1], array[2])
|
||||||
|
|
||||||
def handle_event_gc_invitation(self, account, array):
|
def handle_event_gc_invitation(self, account, array):
|
||||||
#('GC_INVITATION', (room_jid, jid_from, reason, password))
|
#('GC_INVITATION', (room_jid, jid_from, reason, password))
|
||||||
dialogs.InvitationReceivedDialog(account, array[0], array[1],
|
dialogs.InvitationReceivedDialog(account, array[0], array[1],
|
||||||
|
@ -1245,6 +1252,7 @@ class Interface:
|
||||||
'GC_SUBJECT': self.handle_event_gc_subject,
|
'GC_SUBJECT': self.handle_event_gc_subject,
|
||||||
'GC_CONFIG': self.handle_event_gc_config,
|
'GC_CONFIG': self.handle_event_gc_config,
|
||||||
'GC_INVITATION': self.handle_event_gc_invitation,
|
'GC_INVITATION': self.handle_event_gc_invitation,
|
||||||
|
'GC_AFFILIATION': self.handle_event_gc_affiliation,
|
||||||
'BAD_PASSPHRASE': self.handle_event_bad_passphrase,
|
'BAD_PASSPHRASE': self.handle_event_bad_passphrase,
|
||||||
'ROSTER_INFO': self.handle_event_roster_info,
|
'ROSTER_INFO': self.handle_event_roster_info,
|
||||||
'BOOKMARKS': self.handle_event_bookmarks,
|
'BOOKMARKS': self.handle_event_bookmarks,
|
||||||
|
|
37977
src/gtkgui.glade
37977
src/gtkgui.glade
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue