when we right click on a contact that is not in the roster, there is 'add to roster' in the menu (fix ticket #55)

This commit is contained in:
Yann Leboulanger 2005-04-25 20:16:25 +00:00
parent 6afb800eb6
commit 928af2fa9c
1 changed files with 34 additions and 18 deletions

View File

@ -489,6 +489,12 @@ class Roster_window:
sub_menu.append(item)
item.connect('activate', self.req_sub, jid,
_('I would like to add you to my contact list.'), account)
else:
item = gtk.MenuItem()
menu.append(item)
item = gtk.MenuItem(_('Add to roster'))
menu.append(item)
item.connect('activate', self.on_add_to_roster, user, account)
item = gtk.MenuItem(_('Remove'))
menu.append(item)
@ -617,6 +623,9 @@ class Roster_window:
menu.show_all()
menu.reposition()
def on_add_to_roster(self, widget, user, account):
dialogs.Add_new_contact_window(self.plugin, account, user.jid)
def authorize(self, widget, jid, account):
'''Authorize a user'''
gajim.connections[account].send_authorization(jid)
@ -626,12 +635,19 @@ class Roster_window:
if not pseudo:
pseudo = jid
gajim.connections[account].request_subscription(jid, txt)
if not self.contacts[account].has_key(jid):
if not group:
group = 'General'
if not self.contacts[account].has_key(jid):
user1 = User(jid, pseudo, [group], 'requested', 'requested',
'none', 'subscribe', '', 0, '')
self.contacts[account][jid] = [user1]
else:
user1 = self.contacts[account][jid][0]
if not 'not in the roster' in user1.groups:
return
user1.groups = [group]
user1.name = pseudo
self.remove_user(user1, account)
self.add_user_to_roster(jid, account)
def on_roster_treeview_key_press_event(self, widget, event):