plugin.connected[account] -> gajim.connections[account].connected
This commit is contained in:
parent
b40bcc9105
commit
32f9cd5cba
|
@ -984,8 +984,9 @@ class Account_modification_window:
|
|||
priority = self.xml.get_widget('priority_spinbutton').get_value_as_int()
|
||||
new_account_checkbutton = self.xml.get_widget('new_account_checkbutton')
|
||||
name = self.xml.get_widget('name_entry').get_text()
|
||||
if self.plugin.connected.has_key(self.account):
|
||||
if name != self.account and self.plugin.connected[self.account] != 0:
|
||||
if gajim.connections.has_key(self.account):
|
||||
if name != self.account and gajim.connections[self.account].connected \
|
||||
!= 0:
|
||||
Error_dialog(_('You must be offline to change the account\'s name'))
|
||||
return
|
||||
jid = self.xml.get_widget('jid_entry').get_text()
|
||||
|
@ -1078,7 +1079,6 @@ class Account_modification_window:
|
|||
list[0] = name
|
||||
del self.plugin.windows[self.account]
|
||||
del self.plugin.queues[self.account]
|
||||
del self.plugin.connected[self.account]
|
||||
del self.plugin.nicks[self.account]
|
||||
del self.plugin.roster.groups[self.account]
|
||||
del self.plugin.roster.contacts[self.account]
|
||||
|
@ -1230,7 +1230,7 @@ class Account_modification_window:
|
|||
Error_dialog(_('You must first create your account before editing your information'))
|
||||
return
|
||||
jid = self.xml.get_widget('jid_entry').get_text()
|
||||
if self.plugin.connected[self.account] < 2:
|
||||
if gajim.connections[self.account].connected < 2:
|
||||
Error_dialog(_('You must be connected to edit your information'))
|
||||
return
|
||||
if not self.plugin.windows[self.account]['infos'].has_key('vcard'):
|
||||
|
@ -1355,7 +1355,7 @@ class Accounts_window:
|
|||
account = model.get_value(iter, 0)
|
||||
dialog = Confirmation_dialog(_('Are you sure you want to remove account (%s) ?') % account)
|
||||
if dialog.get_response() == gtk.RESPONSE_YES:
|
||||
if self.plugin.connected[account]:
|
||||
if gajim.connections[account].connected:
|
||||
self.plugin.send('STATUS', account, ('offline', 'offline'))
|
||||
del gajim.connections[account]
|
||||
del self.plugin.windows[account]
|
||||
|
@ -1866,8 +1866,8 @@ class Service_discovery_window:
|
|||
self.plugin.save_config()
|
||||
|
||||
def __init__(self, plugin, account):
|
||||
if plugin.connected[account] < 2:
|
||||
Error_dialog(_("You must be connected to browse services"))
|
||||
if gajim.connections[account].connected < 2:
|
||||
Error_dialog(_('You must be connected to browse services'))
|
||||
return
|
||||
xml = gtk.glade.XML(GTKGUI_GLADE, 'service_discovery_window', APP)
|
||||
self.window = xml.get_widget('service_discovery_window')
|
||||
|
|
|
@ -153,8 +153,8 @@ class Vcard_information_window:
|
|||
return vcard
|
||||
|
||||
def on_publish_button_clicked(self, widget):
|
||||
if self.plugin.connected[self.account] < 2:
|
||||
Error_dialog(_("You must be connected to publish your informations"))
|
||||
if gajim.connections[self.account].connected < 2:
|
||||
Error_dialog(_('You must be connected to publish your informations'))
|
||||
return
|
||||
vcard = self.make_vcard()
|
||||
nick = ''
|
||||
|
@ -169,7 +169,7 @@ class Vcard_information_window:
|
|||
entries = ['FN', 'NICKNAME', 'BDAY', 'EMAIL_USERID', 'URL', 'TEL_NUMBER',\
|
||||
'ADR_STREET', 'ADR_EXTADR', 'ADR_LOCALITY', 'ADR_REGION', 'ADR_PCODE',\
|
||||
'ADR_CTRY', 'ORG_ORGNAME', 'ORG_ORGUNIT', 'TITLE', 'ROLE']
|
||||
if self.plugin.connected[self.account] > 1:
|
||||
if gajim.connections[self.account].connected > 1:
|
||||
# clear all entries
|
||||
for e in entries:
|
||||
self.xml.get_widget(e + '_entry').set_text('')
|
||||
|
@ -434,7 +434,7 @@ class Change_status_message_dialog:
|
|||
class Add_new_contact_window:
|
||||
"""Class for Add_new_contact_window"""
|
||||
def __init__(self, plugin, account, jid=None):
|
||||
if plugin.connected[account] < 2:
|
||||
if gajim.connections[account].connected < 2:
|
||||
Error_dialog(_('You must be connected to add a contact'))
|
||||
return
|
||||
self.plugin = plugin
|
||||
|
@ -659,7 +659,7 @@ class subscription_request_window:
|
|||
|
||||
class Join_groupchat_window:
|
||||
def __init__(self, plugin, account, server='', room = ''):
|
||||
if plugin.connected[account] < 2:
|
||||
if gajim.connections[account].connected < 2:
|
||||
Error_dialog(_('You must be connected to join a groupchat'))
|
||||
return
|
||||
self.plugin = plugin
|
||||
|
@ -725,7 +725,7 @@ class Join_groupchat_window:
|
|||
|
||||
class New_message_dialog:
|
||||
def __init__(self, plugin, account):
|
||||
if plugin.connected[account] < 2:
|
||||
if gajim.connections[account].connected < 2:
|
||||
Error_dialog(_('You must be connected to send a message to a contact'))
|
||||
return
|
||||
self.plugin = plugin
|
||||
|
@ -778,7 +778,7 @@ class New_message_dialog:
|
|||
|
||||
class Change_password_dialog:
|
||||
def __init__(self, plugin, account):
|
||||
if plugin.connected[account] < 2:
|
||||
if gajim.connections[account].connected < 2:
|
||||
Error_dialog(_('You must be connected to change your password'))
|
||||
return
|
||||
self.plugin = plugin
|
||||
|
|
|
@ -291,7 +291,8 @@ class interface:
|
|||
self.roster.to_be_removed[account].remove(user1.jid)
|
||||
gobject.timeout_add(5000, self.roster.remove_newly_added, \
|
||||
user1.jid, account)
|
||||
if old_show > 1 and new_show == 0 and self.connected[account] > 1:
|
||||
if old_show > 1 and new_show == 0 and gajim.connections[account].\
|
||||
connected > 1:
|
||||
if not user1.jid in self.roster.to_be_removed[account]:
|
||||
self.roster.to_be_removed[account].append(user1.jid)
|
||||
if user1.jid in self.roster.newly_added[account]:
|
||||
|
|
|
@ -110,7 +110,7 @@ class Roster_window:
|
|||
return
|
||||
statuss = ['offline', 'connecting', 'online', 'away', 'xa', 'dnd',\
|
||||
'invisible']
|
||||
status = statuss[self.plugin.connected[account]]
|
||||
status = statuss[gajim.connections[account].connected]
|
||||
model.append(None, (self.pixbufs[status], account, 'account', account,\
|
||||
account, False))
|
||||
|
||||
|
@ -692,18 +692,18 @@ class Roster_window:
|
|||
|
||||
def send_status(self, account, status, txt, autoconnect=0):
|
||||
if status != 'offline':
|
||||
if self.plugin.connected[account] < 2:
|
||||
if gajim.connections[account].connected < 2:
|
||||
model = self.tree.get_model()
|
||||
accountIter = self.get_account_iter(account)
|
||||
if accountIter:
|
||||
model.set_value(accountIter, 0, self.pixbufs['connecting'])
|
||||
self.plugin.connected[account] = 1
|
||||
gajim.connections[account].connected = 1
|
||||
if self.plugin.systray_enabled:
|
||||
self.plugin.systray.set_status('connecting')
|
||||
|
||||
save_pass = 0
|
||||
save_pass = gajim.config.get_per('accounts', account, 'savepass')
|
||||
if not save_pass and self.plugin.connected[account] < 2:
|
||||
if not save_pass and gajim.connections[account].connected < 2:
|
||||
passphrase = ''
|
||||
w = Passphrase_dialog(_('Enter your password for account %s') \
|
||||
% account, 'Save password', autoconnect)
|
||||
|
@ -711,7 +711,7 @@ class Roster_window:
|
|||
if passphrase == -1:
|
||||
if accountIter:
|
||||
model.set_value(accountIter, 0, self.pixbufs['offline'])
|
||||
self.plugin.connected[account] = 0
|
||||
gajim.connections[account].connected = 0
|
||||
self.plugin.systray.set_status('offline')
|
||||
self.update_status_comboxbox()
|
||||
return
|
||||
|
@ -725,7 +725,7 @@ class Roster_window:
|
|||
save_gpg_pass = gajim.config.get_per('accounts', account, \
|
||||
'savegpgpass')
|
||||
keyid = gajim.config.get_per('accounts', account, 'keyid')
|
||||
if keyid and self.plugin.connected[account] < 2 and \
|
||||
if keyid and gajim.connections[account].connected < 2 and \
|
||||
gajim.config.get('usegpg'):
|
||||
if save_gpg_pass:
|
||||
passphrase = gajim.config.get_per('accounts', account, \
|
||||
|
@ -796,8 +796,9 @@ class Roster_window:
|
|||
#table to change index in plugin.connected to index in combobox
|
||||
table = {0:5, 1:5, 2:0, 3:1, 4:2, 5:3, 6:4}
|
||||
maxi = 0
|
||||
if len(self.plugin.connected.values()):
|
||||
maxi = max(self.plugin.connected.values())
|
||||
for account in gajim.connections:
|
||||
if gajim.connections[account].connected > maxi:
|
||||
maxi = gajim.connections[account].connected
|
||||
#temporarily block signal in order not to send status that we show
|
||||
#in the combobox
|
||||
self.status_combobox.handler_block(self.id_signal_cb)
|
||||
|
@ -832,7 +833,7 @@ class Roster_window:
|
|||
luser_copy.append(user)
|
||||
for user in luser_copy:
|
||||
self.chg_user_status(user, 'offline', 'Disconnected', account)
|
||||
self.plugin.connected[account] = statuss.index(status)
|
||||
gajim.connections[account].connected = statuss.index(status)
|
||||
self.update_status_comboxbox()
|
||||
|
||||
def new_chat(self, user, account):
|
||||
|
@ -881,7 +882,7 @@ class Roster_window:
|
|||
autopopup = gajim.config.get('autopopup')
|
||||
autopopupaway = gajim.config.get('autopopupaway')
|
||||
if (autopopup == 0 or ( not autopopupaway and \
|
||||
self.plugin.connected[account] > 2)) and not \
|
||||
gajim.connections[account].connected > 2)) and not \
|
||||
self.plugin.windows[account]['chats'].has_key(jid):
|
||||
#We save it in a queue
|
||||
if not self.plugin.queues[account].has_key(jid):
|
||||
|
@ -955,7 +956,7 @@ class Roster_window:
|
|||
accounts = gajim.connections.keys()
|
||||
get_msg = False
|
||||
for acct in accounts:
|
||||
if self.plugin.connected[acct]:
|
||||
if gajim.connections[acct].connected:
|
||||
get_msg = True
|
||||
break
|
||||
if get_msg:
|
||||
|
@ -963,7 +964,7 @@ class Roster_window:
|
|||
if message == -1:
|
||||
message = ''
|
||||
for acct in accounts:
|
||||
if self.plugin.connected[acct]:
|
||||
if gajim.connections[acct].connected:
|
||||
self.send_status(acct, 'offline', message)
|
||||
self.quit_gtkgui_plugin()
|
||||
return True # do NOT destory the window
|
||||
|
@ -991,7 +992,7 @@ class Roster_window:
|
|||
accounts = gajim.connections.keys()
|
||||
get_msg = False
|
||||
for acct in accounts:
|
||||
if self.plugin.connected[acct]:
|
||||
if gajim.connections[acct].connected:
|
||||
get_msg = True
|
||||
break
|
||||
if get_msg:
|
||||
|
@ -999,7 +1000,7 @@ class Roster_window:
|
|||
if message == -1:
|
||||
return
|
||||
for acct in accounts:
|
||||
if self.plugin.connected[acct]:
|
||||
if gajim.connections[acct].connected:
|
||||
self.send_status(acct, 'offline', message)
|
||||
self.quit_gtkgui_plugin()
|
||||
|
||||
|
@ -1146,7 +1147,7 @@ class Roster_window:
|
|||
# Update the systray
|
||||
if self.plugin.systray_enabled:
|
||||
self.plugin.systray.set_img()
|
||||
for account in gajim.connected:
|
||||
for account in gajim.connections:
|
||||
# Update opened chat windows
|
||||
for jid in self.plugin.windows[account]['chats']:
|
||||
if jid != 'tabbed':
|
||||
|
|
|
@ -176,7 +176,7 @@ class Tabbed_chat_window(Chat):
|
|||
event.keyval == gtk.keysyms.KP_Enter: # ENTER
|
||||
if (event.state & gtk.gdk.SHIFT_MASK):
|
||||
return False
|
||||
if self.plugin.connected[self.account] < 2: #we are not connected
|
||||
if gajim.connections[self.account].connected < 2: #we are not connected
|
||||
Error_dialog(_('You are not connected, so you cannot send a message'))
|
||||
return True
|
||||
message_buffer = widget.get_buffer()
|
||||
|
|
Loading…
Reference in New Issue