we can now choose a group when we add a user

This commit is contained in:
Yann Leboulanger 2005-03-27 21:35:55 +00:00
parent 0efac5ef4d
commit f1e6a30dcc
5 changed files with 18 additions and 6 deletions

View file

@ -572,7 +572,7 @@ class GajimCore:
def connect(self, account):
"""Connect and authentificate to the Jabber server"""
hostname = self.cfgParser.tab[account]["hostname"]
hostname = self.cfgParser.tab[account]['hostname']
name = self.cfgParser.tab[account]["name"]
password = self.passwords[account]
if not self.cfgParser.tab[account].has_key('resource'):

View file

@ -423,7 +423,9 @@ class Add_contact_window:
start_iter = message_buffer.get_start_iter()
end_iter = message_buffer.get_end_iter()
message = message_buffer.get_text(start_iter, end_iter, 0)
self.plugin.roster.req_sub(self, jid, message, self.account, nickname)
group = self.group_comboboxentry.child.get_text()
self.plugin.roster.req_sub(self, jid, message, self.account, group,\
nickname)
if self.xml.get_widget('auto_authorize_checkbutton').get_active():
self.plugin.send('AUTH', self.account, jid)
widget.get_toplevel().destroy()
@ -512,6 +514,13 @@ class Add_contact_window:
self.xml.get_widget('uid_entry').set_text(jid_splited[0])
if jid_splited[1] in jid_agents:
protocol_combobox.set_active(jid_agents.index(jid_splited[1])+1)
self.group_comboboxentry = self.xml.get_widget('group_comboboxentry')
liststore = gtk.ListStore(str)
self.group_comboboxentry.set_model(liststore)
for g in self.plugin.roster.groups[account].keys():
self.group_comboboxentry.append_text(g)
self.xml.signal_autoconnect(self)
class About_dialog:

View file

@ -1944,7 +1944,7 @@
</child>
<child>
<widget class="GtkComboBoxEntry" id="comboboxentry1">
<widget class="GtkComboBoxEntry" id="group_comboboxentry">
<property name="visible">True</property>
<property name="items" translatable="yes"></property>
<property name="add_tearoffs">False</property>

View file

@ -585,7 +585,8 @@ class plugin:
user.name = name
user.sub = array[2]
user.ask = array[3]
user.groups = array[4]
if array[4]:
user.groups = array[4]
self.roster.redraw_jid(jid, account)
def read_queue(self):

View file

@ -590,13 +590,15 @@ class Roster_window:
"""Authorize a user"""
self.plugin.send('AUTH', account, jid)
def req_sub(self, widget, jid, txt, account, pseudo=None):
def req_sub(self, widget, jid, txt, account, group=None, pseudo=None):
"""Request subscription to a user"""
if not pseudo:
pseudo = jid
self.plugin.send('SUB', account, (jid, txt))
if not self.contacts[account].has_key(jid):
user1 = User(jid, pseudo, ['General'], 'requested', \
if not group:
group = 'General'
user1 = User(jid, pseudo, [group], 'requested', \
'requested', 'none', 'subscribe', '', 0, '')
self.contacts[account][jid] = [user1]
self.add_user_to_roster(jid, account)