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:
parent
6afb800eb6
commit
928af2fa9c
|
@ -475,20 +475,26 @@ class Roster_window:
|
||||||
item = gtk.MenuItem(_('Edit groups'))
|
item = gtk.MenuItem(_('Edit groups'))
|
||||||
menu.append(item)
|
menu.append(item)
|
||||||
item.connect('activate', self.on_edit_groups, user, account)
|
item.connect('activate', self.on_edit_groups, user, account)
|
||||||
item = gtk.MenuItem()
|
item = gtk.MenuItem()
|
||||||
menu.append(item)
|
menu.append(item)
|
||||||
item = gtk.MenuItem(_('Subscription'))
|
item = gtk.MenuItem(_('Subscription'))
|
||||||
menu.append(item)
|
menu.append(item)
|
||||||
|
|
||||||
sub_menu = gtk.Menu()
|
sub_menu = gtk.Menu()
|
||||||
item.set_submenu(sub_menu)
|
item.set_submenu(sub_menu)
|
||||||
item = gtk.MenuItem(_('Resend authorization to'))
|
item = gtk.MenuItem(_('Resend authorization to'))
|
||||||
sub_menu.append(item)
|
sub_menu.append(item)
|
||||||
item.connect('activate', self.authorize, jid, account)
|
item.connect('activate', self.authorize, jid, account)
|
||||||
item = gtk.MenuItem(_('Rerequest authorization from'))
|
item = gtk.MenuItem(_('Rerequest authorization from'))
|
||||||
sub_menu.append(item)
|
sub_menu.append(item)
|
||||||
item.connect('activate', self.req_sub, jid,
|
item.connect('activate', self.req_sub, jid,
|
||||||
_('I would like to add you to my contact list.'), account)
|
_('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'))
|
item = gtk.MenuItem(_('Remove'))
|
||||||
menu.append(item)
|
menu.append(item)
|
||||||
|
@ -617,6 +623,9 @@ class Roster_window:
|
||||||
menu.show_all()
|
menu.show_all()
|
||||||
menu.reposition()
|
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):
|
def authorize(self, widget, jid, account):
|
||||||
'''Authorize a user'''
|
'''Authorize a user'''
|
||||||
gajim.connections[account].send_authorization(jid)
|
gajim.connections[account].send_authorization(jid)
|
||||||
|
@ -626,13 +635,20 @@ class Roster_window:
|
||||||
if not pseudo:
|
if not pseudo:
|
||||||
pseudo = jid
|
pseudo = jid
|
||||||
gajim.connections[account].request_subscription(jid, txt)
|
gajim.connections[account].request_subscription(jid, txt)
|
||||||
|
if not group:
|
||||||
|
group = 'General'
|
||||||
if not self.contacts[account].has_key(jid):
|
if not self.contacts[account].has_key(jid):
|
||||||
if not group:
|
|
||||||
group = 'General'
|
|
||||||
user1 = User(jid, pseudo, [group], 'requested', 'requested',
|
user1 = User(jid, pseudo, [group], 'requested', 'requested',
|
||||||
'none', 'subscribe', '', 0, '')
|
'none', 'subscribe', '', 0, '')
|
||||||
self.contacts[account][jid] = [user1]
|
self.contacts[account][jid] = [user1]
|
||||||
self.add_user_to_roster(jid, account)
|
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):
|
def on_roster_treeview_key_press_event(self, widget, event):
|
||||||
'''when a key is pressed in the treeviews'''
|
'''when a key is pressed in the treeviews'''
|
||||||
|
|
Loading…
Reference in New Issue