We can now set a pseudo in the add contact Window
This commit is contained in:
parent
1d2380b6d7
commit
c0cbef4c09
|
@ -429,7 +429,7 @@ class GajimCore:
|
|||
elif typ == 'subscribed':
|
||||
jid = prs.getFrom()
|
||||
self.hub.sendPlugin('SUBSCRIBED', self.connexions[con],\
|
||||
(jid.getStripped(), jid.getNode(), jid.getResource()))
|
||||
(jid.getStripped(), jid.getResource()))
|
||||
self.hub.queueIn.put(('UPDUSER', self.connexions[con], \
|
||||
(jid.getStripped(), jid.getNode(), ['general'])))
|
||||
#BE CAREFUL : no con.updateRosterItem() in a callback
|
||||
|
|
|
@ -360,8 +360,8 @@ class addContact_Window:
|
|||
def on_subscribe(self, widget):
|
||||
"""When Subscribe button is clicked"""
|
||||
textview_sub = self.xml.get_widget("textview_sub")
|
||||
entry_who = self.xml.get_widget('entry_who')
|
||||
who = entry_who.get_text()
|
||||
who = self.xml.get_widget('entry_who').get_text()
|
||||
pseudo = self.xml.get_widget('entry_pseudo').get_text()
|
||||
if not who:
|
||||
return
|
||||
if who.find('@') < 0:
|
||||
|
@ -371,7 +371,7 @@ class addContact_Window:
|
|||
start_iter = buf.get_start_iter()
|
||||
end_iter = buf.get_end_iter()
|
||||
txt = buf.get_text(start_iter, end_iter, 0)
|
||||
self.plugin.roster.req_sub(self, who, txt, self.account)
|
||||
self.plugin.roster.req_sub(self, who, txt, self.account, pseudo)
|
||||
widget.get_toplevel().destroy()
|
||||
|
||||
def fill_who(self):
|
||||
|
@ -379,7 +379,8 @@ class addContact_Window:
|
|||
model = cb.get_model()
|
||||
index = cb.get_active()
|
||||
str = self.xml.get_widget('entry_login').get_text()
|
||||
str = str.replace("@", "%")
|
||||
if index > 0:
|
||||
str = str.replace("@", "%")
|
||||
agent = model[index][1]
|
||||
if agent:
|
||||
str += "@" + agent
|
||||
|
@ -403,15 +404,25 @@ class addContact_Window:
|
|||
cb.set_active(self.agents.index('ICQ'))
|
||||
return
|
||||
cb.set_active(0)
|
||||
|
||||
def set_pseudo(self):
|
||||
login = self.xml.get_widget('entry_login').get_text()
|
||||
pseudo = self.xml.get_widget('entry_pseudo').get_text()
|
||||
if pseudo == self.old_login_value:
|
||||
self.xml.get_widget('entry_pseudo').set_text(login)
|
||||
|
||||
def on_entry_login_changed(self, widget):
|
||||
self.guess_agent() #It changes the cb so automatically call fill_who()
|
||||
self.guess_agent()
|
||||
self.set_pseudo()
|
||||
self.fill_who()
|
||||
self.old_login_value = self.xml.get_widget('entry_login').get_text()
|
||||
|
||||
def __init__(self, plugin, account, jid=None):
|
||||
self.plugin = plugin
|
||||
self.account = account
|
||||
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Add', APP)
|
||||
self.window = self.xml.get_widget('Add')
|
||||
self.old_login_value = ''
|
||||
liststore = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
|
||||
liststore.append(['Jabber', ''])
|
||||
self.agents = ['Jabber']
|
||||
|
|
|
@ -2172,7 +2172,7 @@ on the server.</property>
|
|||
<child>
|
||||
<widget class="GtkTable" id="table21">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">3</property>
|
||||
<property name="n_rows">4</property>
|
||||
<property name="n_columns">3</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="row_spacing">5</property>
|
||||
|
@ -2221,26 +2221,6 @@ on the server.</property>
|
|||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image184">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
<property name="icon_size">4</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label185">
|
||||
<property name="visible">True</property>
|
||||
|
@ -2328,6 +2308,71 @@ on the server.</property>
|
|||
<property name="y_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image184">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
<property name="icon_size">4</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label188">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Pseudo :</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="entry_pseudo">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="visibility">True</property>
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">10</property>
|
||||
|
|
|
@ -1681,11 +1681,13 @@ class roster_Window:
|
|||
"""Authorize a user"""
|
||||
self.plugin.send('AUTH', account, jid)
|
||||
|
||||
def req_sub(self, widget, jid, txt, account):
|
||||
def req_sub(self, widget, jid, txt, account, 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, jid, ['general'], 'requested', \
|
||||
user1 = user(jid, pseudo, ['general'], 'requested', \
|
||||
'requested', 'none', 'subscribe', '', 0, '')
|
||||
self.contacts[account][jid] = [user1]
|
||||
self.add_user_to_roster(jid, account)
|
||||
|
@ -2687,21 +2689,21 @@ class plugin:
|
|||
authorize_Window(self, array[0], array[1], account)
|
||||
|
||||
def handle_event_subscribed(self, account, array):
|
||||
#('SUBSCRIBED', account, (jid, nom, resource))
|
||||
#('SUBSCRIBED', account, (jid, resource))
|
||||
jid = array[0]
|
||||
if self.roster.contacts[account].has_key(jid):
|
||||
u = self.roster.contacts[account][jid][0]
|
||||
u.name = array[1]
|
||||
u.resource = array[2]
|
||||
u.resource = array[1]
|
||||
self.roster.remove_user(u, account)
|
||||
if 'not in list' in u.groups:
|
||||
u.groups.remove('not in list')
|
||||
if len(u.groups) == 0:
|
||||
u.groups = ['general']
|
||||
self.roster.add_user_to_roster(u.jid, account)
|
||||
self.send('UPDUSER', account, (u.jid, u.name, u.groups))
|
||||
else:
|
||||
user1 = user(jid, jid, ['general'], 'online', \
|
||||
'online', 'to', '', array[2], 0, '')
|
||||
'online', 'to', '', array[1], 0, '')
|
||||
self.roster.contacts[account][jid] = [user1]
|
||||
self.roster.add_user_to_roster(jid, account)
|
||||
warning_Window(_("You are now authorized by %s") % jid)
|
||||
|
@ -2823,9 +2825,8 @@ class plugin:
|
|||
return
|
||||
for user in users:
|
||||
name = array[1]
|
||||
if not name:
|
||||
name = jid
|
||||
user.name = name
|
||||
if name:
|
||||
user.name = name
|
||||
user.sub = array[2]
|
||||
user.ask = array[3]
|
||||
user.groups = array[4]
|
||||
|
|
Loading…
Reference in New Issue