correction of some mistake, send and get vCard only when connected

This commit is contained in:
Yann Leboulanger 2004-03-01 01:39:12 +00:00
parent 48258e96d5
commit bad3e45b97
2 changed files with 16 additions and 10 deletions

View file

@ -3078,7 +3078,7 @@ on the server.</property>
</child> </child>
<child> <child>
<widget class="GtkButton" id="button16"> <widget class="GtkButton" id="colorOut">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
@ -3103,7 +3103,7 @@ on the server.</property>
</child> </child>
<child> <child>
<widget class="GtkButton" id="button17"> <widget class="GtkButton" id="colorStatus">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
@ -3128,7 +3128,7 @@ on the server.</property>
</child> </child>
<child> <child>
<widget class="GtkButton" id="button18"> <widget class="GtkButton" id="colorIn">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>

View file

@ -76,9 +76,6 @@ class vCard_Window:
except AttributeError, e: except AttributeError, e:
pass pass
def on_retrieve(self, widget):
self.r.queueOUT.put(('ASK_VCARD', self.jid))
def add_to_vcard(self, vcard, entry, txt): def add_to_vcard(self, vcard, entry, txt):
entries = string.split(entry, '_') entries = string.split(entry, '_')
loc = vcard loc = vcard
@ -90,8 +87,16 @@ class vCard_Window:
loc[entries[0]] = txt loc[entries[0]] = txt
return vcard return vcard
def on_retrieve(self, widget):
if self.r.connected:
self.r.queueOUT.put(('ASK_VCARD', self.jid))
else:
warning_Window("You must be connected to get your informations")
def on_publish(self, widget): def on_publish(self, widget):
if not self.r.connected:
warning_Window("You must be connected to publish your informations")
return
entries = ['FN', 'NICKNAME', 'BDAY', 'EMAIL_USERID', 'URL', 'TEL_NUMBER',\ entries = ['FN', 'NICKNAME', 'BDAY', 'EMAIL_USERID', 'URL', 'TEL_NUMBER',\
'ADR_STREET', 'ADR_EXTADR', 'ADR_LOCALITY', 'ADR_REGION', 'ADR_PCODE',\ 'ADR_STREET', 'ADR_EXTADR', 'ADR_LOCALITY', 'ADR_REGION', 'ADR_PCODE',\
'ADR_CTRY', 'ORG_ORGNAME', 'ORG_ORGUNIT', 'TITLE', 'ROLE'] 'ADR_CTRY', 'ORG_ORGNAME', 'ORG_ORGUNIT', 'TITLE', 'ROLE']
@ -609,7 +614,10 @@ class accountPreference_Window:
def on_edit_details_clicked(self, widget): def on_edit_details_clicked(self, widget):
if not self.accs.r.tab_vcard.has_key(self.entryJid.get_text()): if not self.accs.r.tab_vcard.has_key(self.entryJid.get_text()):
self.accs.r.tab_vcard[self.entryJid.get_text()] = vCard_Window(self, self.entryJid.get_text()) self.accs.r.tab_vcard[self.entryJid.get_text()] = vCard_Window(self, self.entryJid.get_text())
self.accs.r.queueOUT.put(('ASK_VCARD', self.entryJid.get_text())) if self.accs.r.connected:
self.accs.r.queueOUT.put(('ASK_VCARD', self.entryJid.get_text()))
else:
warning_Window("You must be connected to get your informations")
#info must be a dictionnary #info must be a dictionnary
def __init__(self, accs, infos = {}): def __init__(self, accs, infos = {}):
@ -761,7 +769,6 @@ class authorize_Window:
self.r = roster self.r = roster
self.jid = jid self.jid = jid
xml.get_widget('label').set_text('Subscription request from ' + self.jid) xml.get_widget('label').set_text('Subscription request from ' + self.jid)
#TOTOTO
xml.get_widget("textview_sub").get_buffer().set_text(txt) xml.get_widget("textview_sub").get_buffer().set_text(txt)
xml.signal_connect('on_button_auth_clicked', self.auth) xml.signal_connect('on_button_auth_clicked', self.auth)
xml.signal_connect('on_button_deny_clicked', self.deny) xml.signal_connect('on_button_deny_clicked', self.deny)
@ -1598,13 +1605,12 @@ class plugin:
'autoxa':0,\ 'autoxa':0,\
'autoxatime':20,\ 'autoxatime':20,\
'iconstyle':'sun',\ 'iconstyle':'sun',\
'inmsgcolor':'#ff000',\ 'inmsgcolor':'#ff0000',\
'outmsgcolor': '#0000ff',\ 'outmsgcolor': '#0000ff',\
'statusmsgcolor':'#1eaa1e'}))) 'statusmsgcolor':'#1eaa1e'})))
self.config = self.wait('CONFIG') self.config = self.wait('CONFIG')
quOUT.put(('ASK_CONFIG', ('GtkGui', 'accounts'))) quOUT.put(('ASK_CONFIG', ('GtkGui', 'accounts')))
self.accounts = self.wait('CONFIG') self.accounts = self.wait('CONFIG')
#TODO: if no config : default config and save it
self.r = roster_Window(quOUT, self) self.r = roster_Window(quOUT, self)
if self.config.has_key('autoaway'): if self.config.has_key('autoaway'):
self.autoaway = self.config['autoaway'] self.autoaway = self.config['autoaway']