move var that have nothing to do with GTK to gajim instead of roster or gajim.py: contacts, groups, newly_added, to_be_removed, awaiting_messages (was queues), nicks, allow_notifications, con_types, sleeper_state
This commit is contained in:
parent
bee9df2142
commit
a47cca07f0
11 changed files with 248 additions and 250 deletions
|
@ -691,8 +691,8 @@ class Chat:
|
||||||
self.on_join_group_chat_menuitem_activate, text)
|
self.on_join_group_chat_menuitem_activate, text)
|
||||||
|
|
||||||
allow_add = False
|
allow_add = False
|
||||||
if self.plugin.roster.contacts[self.account].has_key(text):
|
if gajim.contacts[self.account].has_key(text):
|
||||||
c = self.plugin.roster.contacts[self.account][text][0]
|
c = gajim.contacts[self.account][text][0]
|
||||||
if _('not in the roster') in c.groups:
|
if _('not in the roster') in c.groups:
|
||||||
allow_add = True
|
allow_add = True
|
||||||
else: # he's not at all in the account contacts
|
else: # he's not at all in the account contacts
|
||||||
|
|
|
@ -44,3 +44,17 @@ else:
|
||||||
last_message_time = {} # list of time of the latest incomming message
|
last_message_time = {} # list of time of the latest incomming message
|
||||||
# {acct1: {jid1: time1, jid2: time2}, }
|
# {acct1: {jid1: time1, jid2: time2}, }
|
||||||
encrypted_chats = {} # list of encrypted chats {acct1: [jid1, jid2], ..}
|
encrypted_chats = {} # list of encrypted chats {acct1: [jid1, jid2], ..}
|
||||||
|
|
||||||
|
contacts = {} # list of contacts {acct: {jid1: [C1, C2]}, } one Contact per resource
|
||||||
|
groups = {} # list of groups
|
||||||
|
newly_added = {} # list of contacts that has just signed in
|
||||||
|
to_be_removed = {} # list of contacts that has just signed out
|
||||||
|
awaiting_messages = {} # list of messages reveived but not printed
|
||||||
|
nicks = {} # list of our nick names in each account
|
||||||
|
allow_notifications = {} # do we allow notifications for each account ?
|
||||||
|
con_types = {} # type of each connection (ssl, tls, tcp, ...)
|
||||||
|
sleeper_state = {} #whether we pass auto away / xa or not
|
||||||
|
#0:don't use sleeper for this account
|
||||||
|
#1:online and use sleeper
|
||||||
|
#2:autoaway and use sleeper
|
||||||
|
#3:autoxa and use sleeper
|
||||||
|
|
|
@ -491,7 +491,7 @@ class PreferencesWindow:
|
||||||
#open new tabbed chat windows
|
#open new tabbed chat windows
|
||||||
for jid in jids:
|
for jid in jids:
|
||||||
if kind == 'chats':
|
if kind == 'chats':
|
||||||
user = self.plugin.roster.contacts[acct][jid][0]
|
user = gajim.contacts[acct][jid][0]
|
||||||
self.plugin.roster.new_chat(user, acct)
|
self.plugin.roster.new_chat(user, acct)
|
||||||
if kind == 'gc':
|
if kind == 'gc':
|
||||||
self.plugin.roster.new_room(jid, saved_var[jid]['nick'], acct)
|
self.plugin.roster.new_room(jid, saved_var[jid]['nick'], acct)
|
||||||
|
@ -524,7 +524,7 @@ class PreferencesWindow:
|
||||||
#open new tabbed chat windows
|
#open new tabbed chat windows
|
||||||
for jid in jids:
|
for jid in jids:
|
||||||
if kind == 'chats':
|
if kind == 'chats':
|
||||||
user = self.plugin.roster.contacts[acct][jid][0]
|
user = gajim.contacts[acct][jid][0]
|
||||||
self.plugin.roster.new_chat(user, acct)
|
self.plugin.roster.new_chat(user, acct)
|
||||||
if kind == 'gc':
|
if kind == 'gc':
|
||||||
self.plugin.roster.new_room(jid, saved_var[jid]['nick'], acct)
|
self.plugin.roster.new_room(jid, saved_var[jid]['nick'], acct)
|
||||||
|
@ -1165,20 +1165,16 @@ _('To change the account name, you must be disconnected.')).get_response()
|
||||||
if name != self.account:
|
if name != self.account:
|
||||||
#update variables
|
#update variables
|
||||||
self.plugin.windows[name] = self.plugin.windows[self.account]
|
self.plugin.windows[name] = self.plugin.windows[self.account]
|
||||||
self.plugin.queues[name] = self.plugin.queues[self.account]
|
gajim.awaiting_messages[name] = \
|
||||||
self.plugin.nicks[name] = self.plugin.nicks[self.account]
|
gajim.awaiting_messages[self.account]
|
||||||
self.plugin.allow_notifications[name] = \
|
gajim.nicks[name] = gajim.nicks[self.account]
|
||||||
self.plugin.allow_notifications[self.account]
|
gajim.allow_notifications[name] = \
|
||||||
self.plugin.roster.groups[name] = \
|
gajim.allow_notifications[self.account]
|
||||||
self.plugin.roster.groups[self.account]
|
gajim.groups[name] = gajim.groups[self.account]
|
||||||
self.plugin.roster.contacts[name] = \
|
gajim.contacts[name] = gajim.contacts[self.account]
|
||||||
self.plugin.roster.contacts[self.account]
|
gajim.newly_added[name] = gajim.newly_added[self.account]
|
||||||
self.plugin.roster.newly_added[name] = \
|
gajim.to_be_removed[name] = gajim.to_be_removed[self.account]
|
||||||
self.plugin.roster.newly_added[self.account]
|
gajim.sleeper_state[name] = gajim.sleeper_state[self.account]
|
||||||
self.plugin.roster.to_be_removed[name] = \
|
|
||||||
self.plugin.roster.to_be_removed[self.account]
|
|
||||||
self.plugin.sleeper_state[name] = \
|
|
||||||
self.plugin.sleeper_state[self.account]
|
|
||||||
gajim.encrypted_chats[name] = gajim.encrypted_chats[self.account]
|
gajim.encrypted_chats[name] = gajim.encrypted_chats[self.account]
|
||||||
gajim.last_message_time[name] = \
|
gajim.last_message_time[name] = \
|
||||||
gajim.last_message_time[self.account]
|
gajim.last_message_time[self.account]
|
||||||
|
@ -1195,12 +1191,14 @@ _('To change the account name, you must be disconnected.')).get_response()
|
||||||
list[0] = name
|
list[0] = name
|
||||||
|
|
||||||
del self.plugin.windows[self.account]
|
del self.plugin.windows[self.account]
|
||||||
del self.plugin.queues[self.account]
|
del gajim.awaiting_messages[self.account]
|
||||||
del self.plugin.nicks[self.account]
|
del gajim.nicks[self.account]
|
||||||
del self.plugin.allow_notifications[self.account]
|
del gajim.allow_notifications[self.account]
|
||||||
del self.plugin.roster.groups[self.account]
|
del gajim.groups[self.account]
|
||||||
del self.plugin.roster.contacts[self.account]
|
del gajim.contacts[self.account]
|
||||||
del self.plugin.sleeper_state[self.account]
|
del gajim.newly_added[self.account]
|
||||||
|
del gajim.to_be_removed[self.account]
|
||||||
|
del gajim.sleeper_state[self.account]
|
||||||
del gajim.encrypted_chats[self.account]
|
del gajim.encrypted_chats[self.account]
|
||||||
del gajim.last_message_time[self.account]
|
del gajim.last_message_time[self.account]
|
||||||
gajim.connections[self.account].name = name
|
gajim.connections[self.account].name = name
|
||||||
|
@ -1243,15 +1241,15 @@ _('To change the account name, you must be disconnected.')).get_response()
|
||||||
#update variables
|
#update variables
|
||||||
self.plugin.windows[name] = {'infos': {}, 'chats': {}, 'gc': {}, \
|
self.plugin.windows[name] = {'infos': {}, 'chats': {}, 'gc': {}, \
|
||||||
'gc_config': {}}
|
'gc_config': {}}
|
||||||
self.plugin.queues[name] = {}
|
gajim.awaiting_messages[name] = {}
|
||||||
gajim.connections[name].connected = 0
|
gajim.connections[name].connected = 0
|
||||||
self.plugin.roster.groups[name] = {}
|
gajim.groups[name] = {}
|
||||||
self.plugin.roster.contacts[name] = {}
|
gajim.contacts[name] = {}
|
||||||
self.plugin.roster.newly_added[name] = []
|
gajim.newly_added[name] = []
|
||||||
self.plugin.roster.to_be_removed[name] = []
|
gajim.to_be_removed[name] = []
|
||||||
self.plugin.nicks[name] = config['name']
|
gajim.nicks[name] = config['name']
|
||||||
self.plugin.allow_notifications[name] = False
|
gajim.allow_notifications[name] = False
|
||||||
self.plugin.sleeper_state[name] = 0
|
gajim.sleeper_state[name] = 0
|
||||||
gajim.encrypted_chats[name] = []
|
gajim.encrypted_chats[name] = []
|
||||||
gajim.last_message_time[name] = {}
|
gajim.last_message_time[name] = {}
|
||||||
#refresh accounts window
|
#refresh accounts window
|
||||||
|
@ -1272,7 +1270,7 @@ _('To change the account name, you must be disconnected.')).get_response()
|
||||||
new_password = dialog.run()
|
new_password = dialog.run()
|
||||||
if new_password != -1:
|
if new_password != -1:
|
||||||
gajim.connections[self.account].change_password(new_password, \
|
gajim.connections[self.account].change_password(new_password, \
|
||||||
self.plugin.nicks[self.account])
|
gajim.nicks[self.account])
|
||||||
if self.xml.get_widget('save_password_checkbutton').get_active():
|
if self.xml.get_widget('save_password_checkbutton').get_active():
|
||||||
self.xml.get_widget('password_entry').set_text(new_password)
|
self.xml.get_widget('password_entry').set_text(new_password)
|
||||||
|
|
||||||
|
@ -1669,7 +1667,7 @@ class ServiceRegistrationWindow:
|
||||||
user1 = Contact(jid = self.service, name = self.service,
|
user1 = Contact(jid = self.service, name = self.service,
|
||||||
groups = [_('Transports')], show = 'offline', status = 'offline',
|
groups = [_('Transports')], show = 'offline', status = 'offline',
|
||||||
sub = 'from')
|
sub = 'from')
|
||||||
self.plugin.roster.contacts[self.account][self.service] = [user1]
|
gajim.contacts[self.account][self.service] = [user1]
|
||||||
self.plugin.roster.add_contact_to_roster(self.service, self.account)
|
self.plugin.roster.add_contact_to_roster(self.service, self.account)
|
||||||
gajim.connections[self.account].register_agent(self.service, self.infos)
|
gajim.connections[self.account].register_agent(self.service, self.infos)
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
@ -2135,7 +2133,7 @@ _('Without a connection, you can not browse available services')).get_response()
|
||||||
jid = model.get_value(iter, 1)
|
jid = model.get_value(iter, 1)
|
||||||
node = model.get_value(iter, 2)
|
node = model.get_value(iter, 2)
|
||||||
registered_transports = []
|
registered_transports = []
|
||||||
contacts = self.plugin.roster.contacts[self.account]
|
contacts = gajim.contacts[self.account]
|
||||||
for j in contacts:
|
for j in contacts:
|
||||||
if _('Transports') in contacts[j][0].groups:
|
if _('Transports') in contacts[j][0].groups:
|
||||||
registered_transports.append(j)
|
registered_transports.append(j)
|
||||||
|
@ -2334,13 +2332,16 @@ class RemoveAccountWindow:
|
||||||
gajim.config.del_per('accounts', self.account)
|
gajim.config.del_per('accounts', self.account)
|
||||||
self.plugin.save_config()
|
self.plugin.save_config()
|
||||||
del self.plugin.windows[self.account]
|
del self.plugin.windows[self.account]
|
||||||
del self.plugin.queues[self.account]
|
del gajim.awaiting_messages[self.account]
|
||||||
del self.plugin.nicks[self.account]
|
del gajim.nicks[self.account]
|
||||||
del self.plugin.allow_notifications[self.account]
|
del gajim.allow_notifications[self.account]
|
||||||
del self.plugin.roster.groups[self.account]
|
del gajim.groups[self.account]
|
||||||
del self.plugin.roster.contacts[self.account]
|
del gajim.contacts[self.account]
|
||||||
del self.plugin.roster.to_be_removed[self.account]
|
del gajim.to_be_removed[self.account]
|
||||||
del self.plugin.roster.newly_added[self.account]
|
del gajim.newly_added[self.account]
|
||||||
|
del gajim.sleeper_state[self.account]
|
||||||
|
del gajim.encrypted_chats[self.account]
|
||||||
|
del gajim.last_message_time[self.account]
|
||||||
self.plugin.roster.draw_roster()
|
self.plugin.roster.draw_roster()
|
||||||
if self.plugin.windows.has_key('accounts'):
|
if self.plugin.windows.has_key('accounts'):
|
||||||
self.plugin.windows['accounts'].init_accounts()
|
self.plugin.windows['accounts'].init_accounts()
|
||||||
|
|
|
@ -100,7 +100,7 @@ class EditGroupsDialog:
|
||||||
def init_list(self):
|
def init_list(self):
|
||||||
store = gtk.ListStore(str, bool)
|
store = gtk.ListStore(str, bool)
|
||||||
self.list.set_model(store)
|
self.list.set_model(store)
|
||||||
for g in self.plugin.roster.groups[self.account].keys():
|
for g in gajim.groups[self.account].keys():
|
||||||
if g in [_('Transports'), _('not in the roster')]:
|
if g in [_('Transports'), _('not in the roster')]:
|
||||||
continue
|
continue
|
||||||
iter = store.append()
|
iter = store.append()
|
||||||
|
@ -268,8 +268,8 @@ _('Please fill in the data of the contact you want to add in account %s') %accou
|
||||||
liststore.append(['Jabber', ''])
|
liststore.append(['Jabber', ''])
|
||||||
self.agents = ['Jabber']
|
self.agents = ['Jabber']
|
||||||
jid_agents = []
|
jid_agents = []
|
||||||
for j in self.plugin.roster.contacts[account]:
|
for j in gajim.contacts[account]:
|
||||||
user = self.plugin.roster.contacts[account][j][0]
|
user = gajim.contacts[account][j][0]
|
||||||
if _('Transports') in user.groups and user.show != 'offline' and \
|
if _('Transports') in user.groups and user.show != 'offline' and \
|
||||||
user.show != 'error':
|
user.show != 'error':
|
||||||
jid_agents.append(j)
|
jid_agents.append(j)
|
||||||
|
@ -305,7 +305,7 @@ _('Please fill in the data of the contact you want to add in account %s') %accou
|
||||||
self.group_comboboxentry = self.xml.get_widget('group_comboboxentry')
|
self.group_comboboxentry = self.xml.get_widget('group_comboboxentry')
|
||||||
liststore = gtk.ListStore(str)
|
liststore = gtk.ListStore(str)
|
||||||
self.group_comboboxentry.set_model(liststore)
|
self.group_comboboxentry.set_model(liststore)
|
||||||
for g in self.plugin.roster.groups[account].keys():
|
for g in gajim.groups[account].keys():
|
||||||
if g != _('not in the roster') and g != _('Transports'):
|
if g != _('not in the roster') and g != _('Transports'):
|
||||||
self.group_comboboxentry.append_text(g)
|
self.group_comboboxentry.append_text(g)
|
||||||
|
|
||||||
|
@ -698,7 +698,7 @@ class SubscriptionRequestWindow:
|
||||||
'''accept the request'''
|
'''accept the request'''
|
||||||
gajim.connections[self.account].send_authorization(self.jid)
|
gajim.connections[self.account].send_authorization(self.jid)
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
if not self.plugin.roster.contacts[self.account].has_key(self.jid):
|
if not gajim.contacts[self.account].has_key(self.jid):
|
||||||
AddNewContactWindow(self.plugin, self.account, self.jid)
|
AddNewContactWindow(self.plugin, self.account, self.jid)
|
||||||
|
|
||||||
def on_contact_info_button_clicked(self, widget):
|
def on_contact_info_button_clicked(self, widget):
|
||||||
|
@ -735,8 +735,7 @@ _('You can not join a group chat unless you are connected.')).get_response()
|
||||||
self.window = self.xml.get_widget('join_groupchat_window')
|
self.window = self.xml.get_widget('join_groupchat_window')
|
||||||
self.xml.get_widget('server_entry').set_text(server)
|
self.xml.get_widget('server_entry').set_text(server)
|
||||||
self.xml.get_widget('room_entry').set_text(room)
|
self.xml.get_widget('room_entry').set_text(room)
|
||||||
self.xml.get_widget('nickname_entry').set_text(
|
self.xml.get_widget('nickname_entry').set_text(gajim.nicks[self.account])
|
||||||
self.plugin.nicks[self.account])
|
|
||||||
self.xml.signal_autoconnect(self)
|
self.xml.signal_autoconnect(self)
|
||||||
self.plugin.windows[account]['join_gc'] = self #now add us to open windows
|
self.plugin.windows[account]['join_gc'] = self #now add us to open windows
|
||||||
our_jid = gajim.config.get_per('accounts', self.account, 'name') + '@' + \
|
our_jid = gajim.config.get_per('accounts', self.account, 'name') + '@' + \
|
||||||
|
@ -880,8 +879,8 @@ class PopupNotificationWindow:
|
||||||
|
|
||||||
event_type_label.set_markup('<b>' + event_type + '</b>')
|
event_type_label.set_markup('<b>' + event_type + '</b>')
|
||||||
|
|
||||||
if self.jid in self.plugin.roster.contacts[account]:
|
if self.jid in gajim.contacts[account]:
|
||||||
txt = self.plugin.roster.contacts[account][self.jid][0].name
|
txt = gajim.contacts[account][self.jid][0].name
|
||||||
else:
|
else:
|
||||||
txt = self.jid
|
txt = self.jid
|
||||||
|
|
||||||
|
@ -940,8 +939,8 @@ class PopupNotificationWindow:
|
||||||
def on_popup_notification_window_button_press_event(self, widget, event):
|
def on_popup_notification_window_button_press_event(self, widget, event):
|
||||||
# use Contact class, new_chat expects it that way
|
# use Contact class, new_chat expects it that way
|
||||||
# is it in the roster?
|
# is it in the roster?
|
||||||
if self.plugin.roster.contacts[self.account].has_key(self.jid):
|
if gajim.contacts[self.account].has_key(self.jid):
|
||||||
contact = self.plugin.roster.contacts[self.account][self.jid][0]
|
contact = gajim.contacts[self.account][self.jid][0]
|
||||||
else:
|
else:
|
||||||
keyID = ''
|
keyID = ''
|
||||||
attached_keys = gajim.config.get_per('accounts', self.account,
|
attached_keys = gajim.config.get_per('accounts', self.account,
|
||||||
|
@ -951,7 +950,7 @@ class PopupNotificationWindow:
|
||||||
contact = Contact(jid = self.jid, name = self.jid.split('@')[0],
|
contact = Contact(jid = self.jid, name = self.jid.split('@')[0],
|
||||||
groups = [_('not in the roster')], show = 'not in the roster',
|
groups = [_('not in the roster')], show = 'not in the roster',
|
||||||
status = _('not in the roster'), sub = 'none', keyID = keyID)
|
status = _('not in the roster'), sub = 'none', keyID = keyID)
|
||||||
self.plugin.roster.contacts[self.account][self.jid] = [contact]
|
gajim.contacts[self.account][self.jid] = [contact]
|
||||||
self.plugin.roster.add_contact_to_roster(contact.self.jid,
|
self.plugin.roster.add_contact_to_roster(contact.self.jid,
|
||||||
self.account) # FIXME: contact.self.jid ???
|
self.account) # FIXME: contact.self.jid ???
|
||||||
|
|
||||||
|
|
112
src/gajim.py
112
src/gajim.py
|
@ -198,17 +198,17 @@ class Interface:
|
||||||
|
|
||||||
def handle_event_con_type(self, account, con_type):
|
def handle_event_con_type(self, account, con_type):
|
||||||
# ('CON_TYPE', account, con_type) which can be 'ssl', 'tls', 'tcp'
|
# ('CON_TYPE', account, con_type) which can be 'ssl', 'tls', 'tcp'
|
||||||
self.con_types[account] = con_type
|
gajim.con_types[account] = con_type
|
||||||
|
|
||||||
def allow_notif(self, account):
|
def allow_notif(self, account):
|
||||||
self.allow_notifications[account] = True
|
gajim.allow_notifications[account] = True
|
||||||
|
|
||||||
def handle_event_status(self, account, status): # OUR status
|
def handle_event_status(self, account, status): # OUR status
|
||||||
#('STATUS', account, status)
|
#('STATUS', account, status)
|
||||||
if status != 'offline':
|
if status != 'offline':
|
||||||
gobject.timeout_add(30000, self.allow_notif, account)
|
gobject.timeout_add(30000, self.allow_notif, account)
|
||||||
else:
|
else:
|
||||||
self.allow_notifications[account] = False
|
gajim.allow_notifications[account] = False
|
||||||
self.roster.on_status_changed(account, status)
|
self.roster.on_status_changed(account, status)
|
||||||
if self.remote:
|
if self.remote:
|
||||||
self.remote.raise_signal('AccountPresence', (status, account))
|
self.remote.raise_signal('AccountPresence', (status, account))
|
||||||
|
@ -235,8 +235,8 @@ class Interface:
|
||||||
else:
|
else:
|
||||||
ji = jid
|
ji = jid
|
||||||
#Update user
|
#Update user
|
||||||
if self.roster.contacts[account].has_key(ji):
|
if gajim.contacts[account].has_key(ji):
|
||||||
luser = self.roster.contacts[account][ji]
|
luser = gajim.contacts[account][ji]
|
||||||
user1 = None
|
user1 = None
|
||||||
resources = []
|
resources = []
|
||||||
for u in luser:
|
for u in luser:
|
||||||
|
@ -248,7 +248,7 @@ class Interface:
|
||||||
if user1.show in statuss:
|
if user1.show in statuss:
|
||||||
old_show = statuss.index(user1.show)
|
old_show = statuss.index(user1.show)
|
||||||
else:
|
else:
|
||||||
user1 = self.roster.contacts[account][ji][0]
|
user1 = gajim.contacts[account][ji][0]
|
||||||
if user1.show in statuss:
|
if user1.show in statuss:
|
||||||
old_show = statuss.index(user1.show)
|
old_show = statuss.index(user1.show)
|
||||||
if (resources != [''] and (len(luser) != 1 or
|
if (resources != [''] and (len(luser) != 1 or
|
||||||
|
@ -263,20 +263,20 @@ class Interface:
|
||||||
user1.resource = resource
|
user1.resource = resource
|
||||||
if user1.jid.find('@') > 0 and len(luser) == 1: # It's not an agent
|
if user1.jid.find('@') > 0 and len(luser) == 1: # It's not an agent
|
||||||
if old_show == 0 and new_show > 1:
|
if old_show == 0 and new_show > 1:
|
||||||
if not user1.jid in self.roster.newly_added[account]:
|
if not user1.jid in gajim.newly_added[account]:
|
||||||
self.roster.newly_added[account].append(user1.jid)
|
gajim.newly_added[account].append(user1.jid)
|
||||||
if user1.jid in self.roster.to_be_removed[account]:
|
if user1.jid in gajim.to_be_removed[account]:
|
||||||
self.roster.to_be_removed[account].remove(user1.jid)
|
gajim.to_be_removed[account].remove(user1.jid)
|
||||||
gobject.timeout_add(5000, self.roster.remove_newly_added, \
|
gobject.timeout_add(5000, self.roster.remove_newly_added, \
|
||||||
user1.jid, account)
|
user1.jid, account)
|
||||||
if old_show > 1 and new_show == 0 and gajim.connections[account].\
|
if old_show > 1 and new_show == 0 and gajim.connections[account].\
|
||||||
connected > 1:
|
connected > 1:
|
||||||
if not user1.jid in self.roster.to_be_removed[account]:
|
if not user1.jid in gajim.to_be_removed[account]:
|
||||||
self.roster.to_be_removed[account].append(user1.jid)
|
gajim.to_be_removed[account].append(user1.jid)
|
||||||
if user1.jid in self.roster.newly_added[account]:
|
if user1.jid in gajim.newly_added[account]:
|
||||||
self.roster.newly_added[account].remove(user1.jid)
|
gajim.newly_added[account].remove(user1.jid)
|
||||||
self.roster.draw_contact(user1.jid, account)
|
self.roster.draw_contact(user1.jid, account)
|
||||||
if not self.queues[account].has_key(jid):
|
if not gajim.awaiting_messages[account].has_key(jid):
|
||||||
gobject.timeout_add(5000, self.roster.really_remove_user, \
|
gobject.timeout_add(5000, self.roster.really_remove_user, \
|
||||||
user1, account)
|
user1, account)
|
||||||
user1.show = array[1]
|
user1.show = array[1]
|
||||||
|
@ -285,10 +285,10 @@ class Interface:
|
||||||
user1.keyID = keyID
|
user1.keyID = keyID
|
||||||
if jid.find('@') <= 0:
|
if jid.find('@') <= 0:
|
||||||
#It must be an agent
|
#It must be an agent
|
||||||
if self.roster.contacts[account].has_key(ji):
|
if gajim.contacts[account].has_key(ji):
|
||||||
#Update existing iter
|
#Update existing iter
|
||||||
self.roster.draw_contact(ji, account)
|
self.roster.draw_contact(ji, account)
|
||||||
elif self.roster.contacts[account].has_key(ji):
|
elif gajim.contacts[account].has_key(ji):
|
||||||
#It isn't an agent
|
#It isn't an agent
|
||||||
self.roster.chg_contact_status(user1, array[1], array[2], account)
|
self.roster.chg_contact_status(user1, array[1], array[2], account)
|
||||||
#play sound
|
#play sound
|
||||||
|
@ -297,9 +297,9 @@ class Interface:
|
||||||
'enabled'):
|
'enabled'):
|
||||||
self.play_sound('contact_connected')
|
self.play_sound('contact_connected')
|
||||||
if not self.windows[account]['chats'].has_key(jid) and \
|
if not self.windows[account]['chats'].has_key(jid) and \
|
||||||
not self.queues[account].has_key(jid) and \
|
not gajim.awaiting_messages[account].has_key(jid) and \
|
||||||
gajim.config.get('notify_on_signin') and \
|
gajim.config.get('notify_on_signin') and \
|
||||||
self.allow_notifications[account]:
|
gajim.allow_notifications[account]:
|
||||||
show_notification = False
|
show_notification = False
|
||||||
# check OUR status and if we allow notifications for that status
|
# check OUR status and if we allow notifications for that status
|
||||||
if gajim.config.get('autopopupaway'): # always notify
|
if gajim.config.get('autopopupaway'): # always notify
|
||||||
|
@ -318,7 +318,7 @@ class Interface:
|
||||||
'enabled'):
|
'enabled'):
|
||||||
self.play_sound('contact_disconnected')
|
self.play_sound('contact_disconnected')
|
||||||
if not self.windows[account]['chats'].has_key(jid) and \
|
if not self.windows[account]['chats'].has_key(jid) and \
|
||||||
not self.queues[account].has_key(jid) and \
|
not gajim.awaiting_messages[account].has_key(jid) and \
|
||||||
gajim.config.get('notify_on_signout'):
|
gajim.config.get('notify_on_signout'):
|
||||||
show_notification = False
|
show_notification = False
|
||||||
# check OUR status and if we allow notifications for that status
|
# check OUR status and if we allow notifications for that status
|
||||||
|
@ -357,7 +357,7 @@ class Interface:
|
||||||
chat_win = self.windows[account]['chats'][fjid]
|
chat_win = self.windows[account]['chats'][fjid]
|
||||||
chat_win.print_conversation(array[1], fjid, tim = array[2])
|
chat_win.print_conversation(array[1], fjid, tim = array[2])
|
||||||
return
|
return
|
||||||
qs = self.queues[account]
|
qs = gajim.awaiting_messages[account]
|
||||||
if not qs.has_key(fjid):
|
if not qs.has_key(fjid):
|
||||||
qs[fjid] = []
|
qs[fjid] = []
|
||||||
qs[fjid].append((array[1], array[2], array[3]))
|
qs[fjid].append((array[1], array[2], array[3]))
|
||||||
|
@ -371,12 +371,12 @@ class Interface:
|
||||||
|
|
||||||
|
|
||||||
if gajim.config.get('ignore_unknown_contacts') and \
|
if gajim.config.get('ignore_unknown_contacts') and \
|
||||||
not self.roster.contacts[account].has_key(jid):
|
not gajim.contacts[account].has_key(jid):
|
||||||
return
|
return
|
||||||
|
|
||||||
first = False
|
first = False
|
||||||
if not self.windows[account]['chats'].has_key(jid) and \
|
if not self.windows[account]['chats'].has_key(jid) and \
|
||||||
not self.queues[account].has_key(jid):
|
not gajim.awaiting_messages[account].has_key(jid):
|
||||||
first = True
|
first = True
|
||||||
if gajim.config.get('notify_on_new_message'):
|
if gajim.config.get('notify_on_new_message'):
|
||||||
show_notification = False
|
show_notification = False
|
||||||
|
@ -456,8 +456,8 @@ class Interface:
|
||||||
def handle_event_subscribed(self, account, array):
|
def handle_event_subscribed(self, account, array):
|
||||||
#('SUBSCRIBED', account, (jid, resource))
|
#('SUBSCRIBED', account, (jid, resource))
|
||||||
jid = array[0]
|
jid = array[0]
|
||||||
if self.roster.contacts[account].has_key(jid):
|
if gajim.contacts[account].has_key(jid):
|
||||||
u = self.roster.contacts[account][jid][0]
|
u = gajim.contacts[account][jid][0]
|
||||||
u.resource = array[1]
|
u.resource = array[1]
|
||||||
self.roster.remove_user(u, account)
|
self.roster.remove_user(u, account)
|
||||||
if _('not in the roster') in u.groups:
|
if _('not in the roster') in u.groups:
|
||||||
|
@ -475,7 +475,7 @@ class Interface:
|
||||||
user1 = Contact(jid = jid, name = jid.split('@')[0],
|
user1 = Contact(jid = jid, name = jid.split('@')[0],
|
||||||
groups = [_('General')], show = 'online', status = 'online',
|
groups = [_('General')], show = 'online', status = 'online',
|
||||||
ask = 'to', resource = array[1], keyID = keyID)
|
ask = 'to', resource = array[1], keyID = keyID)
|
||||||
self.roster.contacts[account][jid] = [user1]
|
gajim.contacts[account][jid] = [user1]
|
||||||
self.roster.add_contact_to_roster(jid, account)
|
self.roster.add_contact_to_roster(jid, account)
|
||||||
dialogs.InformationDialog(_('Authorization accepted'),
|
dialogs.InformationDialog(_('Authorization accepted'),
|
||||||
_('The contact "%s" has authorized you to see his status.')
|
_('The contact "%s" has authorized you to see his status.')
|
||||||
|
@ -526,15 +526,15 @@ class Interface:
|
||||||
if self.windows.has_key('account_modification'):
|
if self.windows.has_key('account_modification'):
|
||||||
self.windows['account_modification'].account_is_ok(array[0])
|
self.windows['account_modification'].account_is_ok(array[0])
|
||||||
self.windows[name] = {'infos': {}, 'chats': {}, 'gc': {}, 'gc_config': {}}
|
self.windows[name] = {'infos': {}, 'chats': {}, 'gc': {}, 'gc_config': {}}
|
||||||
self.queues[name] = {}
|
gajim.awaiting_messages[name] = {}
|
||||||
gajim.connections[name].connected = 0
|
gajim.connections[name].connected = 0
|
||||||
self.nicks[name] = array[1]['name']
|
gajim.nicks[name] = array[1]['name']
|
||||||
self.allow_notifications[name] = False
|
gajim.allow_notifications[name] = False
|
||||||
self.roster.groups[name] = {}
|
gajim.groups[name] = {}
|
||||||
self.roster.contacts[name] = {}
|
gajim.contacts[name] = {}
|
||||||
self.roster.newly_added[name] = []
|
gajim.newly_added[name] = []
|
||||||
self.roster.to_be_removed[name] = []
|
gajim.to_be_removed[name] = []
|
||||||
self.sleeper_state[name] = 0
|
gajim.sleeper_state[name] = 0
|
||||||
gajim.encrypted_chats[name] = []
|
gajim.encrypted_chats[name] = []
|
||||||
gajim.last_message_time[name] = {}
|
gajim.last_message_time[name] = {}
|
||||||
if self.windows.has_key('accounts'):
|
if self.windows.has_key('accounts'):
|
||||||
|
@ -551,7 +551,7 @@ class Interface:
|
||||||
if array.has_key('NICKNAME'):
|
if array.has_key('NICKNAME'):
|
||||||
nick = array['NICKNAME']
|
nick = array['NICKNAME']
|
||||||
if nick:
|
if nick:
|
||||||
self.nicks[account] = nick
|
gajim.nicks[account] = nick
|
||||||
|
|
||||||
def handle_event_vcard(self, account, array):
|
def handle_event_vcard(self, account, array):
|
||||||
win = None
|
win = None
|
||||||
|
@ -617,12 +617,12 @@ class Interface:
|
||||||
def handle_event_roster_info(self, account, array):
|
def handle_event_roster_info(self, account, array):
|
||||||
#('ROSTER_INFO', account, (jid, name, sub, ask, groups))
|
#('ROSTER_INFO', account, (jid, name, sub, ask, groups))
|
||||||
jid = array[0]
|
jid = array[0]
|
||||||
if not self.roster.contacts[account].has_key(jid):
|
if not gajim.contacts[account].has_key(jid):
|
||||||
return
|
return
|
||||||
users = self.roster.contacts[account][jid]
|
users = gajim.contacts[account][jid]
|
||||||
if not (array[2] or array[3]):
|
if not (array[2] or array[3]):
|
||||||
self.roster.remove_user(users[0], account)
|
self.roster.remove_user(users[0], account)
|
||||||
del self.roster.contacts[account][jid]
|
del gajim.contacts[account][jid]
|
||||||
#TODO if it was the only one in its group, remove the group
|
#TODO if it was the only one in its group, remove the group
|
||||||
return
|
return
|
||||||
for user in users:
|
for user in users:
|
||||||
|
@ -655,26 +655,26 @@ class Interface:
|
||||||
return True # renew timeout (loop for ever)
|
return True # renew timeout (loop for ever)
|
||||||
state = self.sleeper.getState()
|
state = self.sleeper.getState()
|
||||||
for account in gajim.connections:
|
for account in gajim.connections:
|
||||||
if not self.sleeper_state[account]:
|
if not gajim.sleeper_state[account]:
|
||||||
continue
|
continue
|
||||||
if state == common.sleepy.STATE_AWAKE and \
|
if state == common.sleepy.STATE_AWAKE and \
|
||||||
self.sleeper_state[account] > 1:
|
gajim.sleeper_state[account] > 1:
|
||||||
#we go online
|
#we go online
|
||||||
self.roster.send_status(account, 'online', 'Online')
|
self.roster.send_status(account, 'online', 'Online')
|
||||||
self.sleeper_state[account] = 1
|
gajim.sleeper_state[account] = 1
|
||||||
elif state == common.sleepy.STATE_AWAY and \
|
elif state == common.sleepy.STATE_AWAY and \
|
||||||
self.sleeper_state[account] == 1 and \
|
gajim.sleeper_state[account] == 1 and \
|
||||||
gajim.config.get('autoaway'):
|
gajim.config.get('autoaway'):
|
||||||
#we go away
|
#we go away
|
||||||
self.roster.send_status(account, 'away', 'auto away (idle)')
|
self.roster.send_status(account, 'away', 'auto away (idle)')
|
||||||
self.sleeper_state[account] = 2
|
gajim.sleeper_state[account] = 2
|
||||||
elif state == common.sleepy.STATE_XAWAY and (\
|
elif state == common.sleepy.STATE_XAWAY and (\
|
||||||
self.sleeper_state[account] == 2 or \
|
gajim.sleeper_state[account] == 2 or \
|
||||||
self.sleeper_state[account] == 1) and \
|
gajim.sleeper_state[account] == 1) and \
|
||||||
gajim.config.get('autoxa'):
|
gajim.config.get('autoxa'):
|
||||||
#we go extended away
|
#we go extended away
|
||||||
self.roster.send_status(account, 'xa', 'auto away (idle)')
|
self.roster.send_status(account, 'xa', 'auto away (idle)')
|
||||||
self.sleeper_state[account] = 3
|
gajim.sleeper_state[account] = 3
|
||||||
return True # renew timeout (loop for ever)
|
return True # renew timeout (loop for ever)
|
||||||
|
|
||||||
def autoconnect(self):
|
def autoconnect(self):
|
||||||
|
@ -879,20 +879,16 @@ class Interface:
|
||||||
gtk.about_dialog_set_email_hook(self.on_launch_browser_mailer, 'mail')
|
gtk.about_dialog_set_email_hook(self.on_launch_browser_mailer, 'mail')
|
||||||
gtk.about_dialog_set_url_hook(self.on_launch_browser_mailer, 'url')
|
gtk.about_dialog_set_url_hook(self.on_launch_browser_mailer, 'url')
|
||||||
self.windows = {'logs':{}}
|
self.windows = {'logs':{}}
|
||||||
self.queues = {}
|
|
||||||
self.nicks = {}
|
|
||||||
self.allow_notifications = {}
|
|
||||||
self.con_types = {}
|
|
||||||
self.sleeper_state = {} #whether we pass auto away / xa or not
|
|
||||||
for a in gajim.connections:
|
for a in gajim.connections:
|
||||||
self.windows[a] = {'infos': {}, 'chats': {}, 'gc': {}, 'gc_config': {}}
|
self.windows[a] = {'infos': {}, 'chats': {}, 'gc': {}, 'gc_config': {}}
|
||||||
self.queues[a] = {}
|
gajim.contacts[a] = {}
|
||||||
self.nicks[a] = gajim.config.get_per('accounts', a, 'name')
|
gajim.groups[a] = {}
|
||||||
self.allow_notifications[a] = False
|
gajim.newly_added[a] = []
|
||||||
self.sleeper_state[a] = 0 #0:don't use sleeper for this account
|
gajim.to_be_removed[a] = []
|
||||||
#1:online and use sleeper
|
gajim.awaiting_messages[a] = {}
|
||||||
#2:autoaway and use sleeper
|
gajim.nicks[a] = gajim.config.get_per('accounts', a, 'name')
|
||||||
#3:autoxa and use sleeper
|
gajim.allow_notifications[a] = False
|
||||||
|
gajim.sleeper_state[a] = 0
|
||||||
gajim.encrypted_chats[a] = []
|
gajim.encrypted_chats[a] = []
|
||||||
gajim.last_message_time[a] = {}
|
gajim.last_message_time[a] = {}
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ class HistoryWindow:
|
||||||
tag_msg = 'status'
|
tag_msg = 'status'
|
||||||
elif type == 'recv':
|
elif type == 'recv':
|
||||||
try:
|
try:
|
||||||
name = self.plugin.roster.contacts[self.account][self.jid][0].name
|
name = gajim.contacts[self.account][self.jid][0].name
|
||||||
except:
|
except:
|
||||||
name = None
|
name = None
|
||||||
if not name:
|
if not name:
|
||||||
|
@ -148,7 +148,7 @@ class HistoryWindow:
|
||||||
msg = ':'.join(data[0:])
|
msg = ':'.join(data[0:])
|
||||||
tag_name = 'incoming'
|
tag_name = 'incoming'
|
||||||
elif type == 'sent':
|
elif type == 'sent':
|
||||||
name = self.plugin.nicks[self.account]
|
name = gajim.nicks[self.account]
|
||||||
msg = ':'.join(data[0:])
|
msg = ':'.join(data[0:])
|
||||||
tag_name = 'outgoing'
|
tag_name = 'outgoing'
|
||||||
else:
|
else:
|
||||||
|
@ -173,8 +173,8 @@ class HistoryWindow:
|
||||||
self.nb_line = gajim.logger.get_nb_line(jid)
|
self.nb_line = gajim.logger.get_nb_line(jid)
|
||||||
xml = gtk.glade.XML(GTKGUI_GLADE, 'history_window', APP)
|
xml = gtk.glade.XML(GTKGUI_GLADE, 'history_window', APP)
|
||||||
self.window = xml.get_widget('history_window')
|
self.window = xml.get_widget('history_window')
|
||||||
if account and self.plugin.roster.contacts[account].has_key(jid):
|
if account and gajim.contacts[account].has_key(jid):
|
||||||
list_users = self.plugin.roster.contacts[account][self.jid]
|
list_users = gajim.contacts[account][self.jid]
|
||||||
user = list_users[0]
|
user = list_users[0]
|
||||||
title = 'Conversation History with ' + user.name
|
title = 'Conversation History with ' + user.name
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -73,7 +73,6 @@ class SignalObject(DbusPrototype):
|
||||||
def __init__(self, service, plugin):
|
def __init__(self, service, plugin):
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
self.first_show = True
|
self.first_show = True
|
||||||
self.contacts = self.plugin.roster.contacts
|
|
||||||
self.vcard_account = None
|
self.vcard_account = None
|
||||||
|
|
||||||
# register our dbus API
|
# register our dbus API
|
||||||
|
@ -121,8 +120,8 @@ class SignalObject(DbusPrototype):
|
||||||
if account:
|
if account:
|
||||||
self.plugin.connections[account].send_message(jid, message, keyID)
|
self.plugin.connections[account].send_message(jid, message, keyID)
|
||||||
else:
|
else:
|
||||||
for account in self.contacts.keys():
|
for account in gajim.contacts.keys():
|
||||||
if self.contacts[account].has_key(jid):
|
if gajim.contacts[account].has_key(jid):
|
||||||
gajim.connections[account].send_message(jid,
|
gajim.connections[account].send_message(jid,
|
||||||
message, keyID)
|
message, keyID)
|
||||||
return True
|
return True
|
||||||
|
@ -138,14 +137,14 @@ class SignalObject(DbusPrototype):
|
||||||
if account:
|
if account:
|
||||||
accounts = [account]
|
accounts = [account]
|
||||||
else:
|
else:
|
||||||
accounts = self.contacts.keys()
|
accounts = gajim.connections.keys()
|
||||||
|
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
if self.plugin.windows[account]['chats'].has_key(jid):
|
if self.plugin.windows[account]['chats'].has_key(jid):
|
||||||
self.plugin.windows[account]['chats'][jid].set_active_tab(jid)
|
self.plugin.windows[account]['chats'][jid].set_active_tab(jid)
|
||||||
break
|
break
|
||||||
elif self.contacts[account].has_key(jid):
|
elif gajim.contacts[account].has_key(jid):
|
||||||
self.plugin.roster.new_chat(self.contacts[account][jid][0],
|
self.plugin.roster.new_chat(gajim.contacts[account][jid][0],
|
||||||
account)
|
account)
|
||||||
jid_data = self.plugin.windows[account]['chats'][jid]
|
jid_data = self.plugin.windows[account]['chats'][jid]
|
||||||
jid_data.set_active_tab(jid)
|
jid_data.set_active_tab(jid)
|
||||||
|
@ -170,7 +169,7 @@ class SignalObject(DbusPrototype):
|
||||||
status, message)
|
status, message)
|
||||||
else:
|
else:
|
||||||
# account not specified, so change the status of all accounts
|
# account not specified, so change the status of all accounts
|
||||||
for acc in self.contacts.keys():
|
for acc in gajim.contacts.keys():
|
||||||
gobject.idle_add(self.plugin.roster.send_status, acc,
|
gobject.idle_add(self.plugin.roster.send_status, acc,
|
||||||
status, message)
|
status, message)
|
||||||
return None
|
return None
|
||||||
|
@ -190,7 +189,7 @@ class SignalObject(DbusPrototype):
|
||||||
jid_tab = acc['chats'][jid]
|
jid_tab = acc['chats'][jid]
|
||||||
else:
|
else:
|
||||||
self.plugin.roster.new_chat(
|
self.plugin.roster.new_chat(
|
||||||
self.contacts[account][jid][0], account)
|
gajim.contacts[account][jid][0], account)
|
||||||
jid_tab = acc['chats'][jid]
|
jid_tab = acc['chats'][jid]
|
||||||
if jid_tab:
|
if jid_tab:
|
||||||
jid_tab.set_active_tab(jid)
|
jid_tab.set_active_tab(jid)
|
||||||
|
@ -210,11 +209,11 @@ class SignalObject(DbusPrototype):
|
||||||
# FIXME: raise exception for missing argument (0.3+)
|
# FIXME: raise exception for missing argument (0.3+)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
accounts = self.contacts.keys()
|
accounts = gajim.contacts.keys()
|
||||||
iq = None
|
iq = None
|
||||||
|
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
if self.contacts[account].has_key(jid):
|
if gajim.contacts[account].has_key(jid):
|
||||||
self.vcard_account = account
|
self.vcard_account = account
|
||||||
gajim.connections[account].register_handler('VCARD',
|
gajim.connections[account].register_handler('VCARD',
|
||||||
self._receive_vcard)
|
self._receive_vcard)
|
||||||
|
@ -224,8 +223,8 @@ class SignalObject(DbusPrototype):
|
||||||
|
|
||||||
def list_accounts(self, *args):
|
def list_accounts(self, *args):
|
||||||
''' list register accounts '''
|
''' list register accounts '''
|
||||||
if self.contacts:
|
if gajim.contacts:
|
||||||
result = self.contacts.keys()
|
result = gajim.contacts.keys()
|
||||||
if result and len(result) > 0:
|
if result and len(result) > 0:
|
||||||
return result
|
return result
|
||||||
return None
|
return None
|
||||||
|
@ -236,13 +235,13 @@ class SignalObject(DbusPrototype):
|
||||||
then return the contacts for the specified account '''
|
then return the contacts for the specified account '''
|
||||||
[for_account] = self._get_real_arguments(args, 1)
|
[for_account] = self._get_real_arguments(args, 1)
|
||||||
result = []
|
result = []
|
||||||
if not self.contacts or len(self.contacts) == 0:
|
if not gajim.contacts or len(gajim.contacts) == 0:
|
||||||
return None
|
return None
|
||||||
if for_account:
|
if for_account:
|
||||||
if self.contacts.has_key(for_account):
|
if gajim.contacts.has_key(for_account):
|
||||||
for jid in self.contacts[for_account]:
|
for jid in gajim.contacts[for_account]:
|
||||||
item = self._serialized_contacts(
|
item = self._serialized_contacts(
|
||||||
self.contacts[for_account][jid])
|
gajim.contacts[for_account][jid])
|
||||||
if item:
|
if item:
|
||||||
result.append(item)
|
result.append(item)
|
||||||
else:
|
else:
|
||||||
|
@ -250,9 +249,9 @@ class SignalObject(DbusPrototype):
|
||||||
# FIXME: there can be a return status for this [0.3+]
|
# FIXME: there can be a return status for this [0.3+]
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
for account in self.contacts:
|
for account in gajim.contacts:
|
||||||
for jid in self.contacts[account]:
|
for jid in gajim.contacts[account]:
|
||||||
item = self._serialized_contacts(self.contacts[account][jid])
|
item = self._serialized_contacts(gajim.contacts[account][jid])
|
||||||
if item:
|
if item:
|
||||||
result.append(item)
|
result.append(item)
|
||||||
# dbus 0.40 does not support return result as empty list
|
# dbus 0.40 does not support return result as empty list
|
||||||
|
|
|
@ -96,9 +96,9 @@ class RosterWindow:
|
||||||
status = statuss[gajim.connections[account].connected]
|
status = statuss[gajim.connections[account].connected]
|
||||||
|
|
||||||
tls_pixbuf = None
|
tls_pixbuf = None
|
||||||
if self.plugin.con_types.has_key(account) and\
|
if gajim.con_types.has_key(account) and \
|
||||||
(self.plugin.con_types[account] == 'tls' or\
|
(gajim.con_types[account] == 'tls' or \
|
||||||
self.plugin.con_types[account] == 'ssl'):
|
gajim.con_types[account] == 'ssl'):
|
||||||
tls_pixbuf = self.window.render_icon(gtk.STOCK_DIALOG_AUTHENTICATION,
|
tls_pixbuf = self.window.render_icon(gtk.STOCK_DIALOG_AUTHENTICATION,
|
||||||
gtk.ICON_SIZE_MENU) # the only way to create a pixbuf from stock
|
gtk.ICON_SIZE_MENU) # the only way to create a pixbuf from stock
|
||||||
|
|
||||||
|
@ -106,16 +106,16 @@ class RosterWindow:
|
||||||
'account', account, account, False, tls_pixbuf])
|
'account', account, account, False, tls_pixbuf])
|
||||||
|
|
||||||
def remove_newly_added(self, jid, account):
|
def remove_newly_added(self, jid, account):
|
||||||
if jid in self.newly_added[account]:
|
if jid in gajim.newly_added[account]:
|
||||||
self.newly_added[account].remove(jid)
|
gajim.newly_added[account].remove(jid)
|
||||||
self.draw_contact(jid, account)
|
self.draw_contact(jid, account)
|
||||||
|
|
||||||
def add_contact_to_roster(self, jid, account):
|
def add_contact_to_roster(self, jid, account):
|
||||||
'''Add a contact to the roster and add groups if they aren't in roster'''
|
'''Add a contact to the roster and add groups if they aren't in roster'''
|
||||||
showOffline = gajim.config.get('showoffline')
|
showOffline = gajim.config.get('showoffline')
|
||||||
if not self.contacts[account].has_key(jid):
|
if not gajim.contacts[account].has_key(jid):
|
||||||
return
|
return
|
||||||
users = self.contacts[account][jid]
|
users = gajim.contacts[account][jid]
|
||||||
user = users[0]
|
user = users[0]
|
||||||
if user.jid.find('@') <= 0: # if not '@' or '@' starts the jid ==> agent
|
if user.jid.find('@') <= 0: # if not '@' or '@' starts the jid ==> agent
|
||||||
user.groups = [_('Transports')]
|
user.groups = [_('Transports')]
|
||||||
|
@ -125,7 +125,7 @@ class RosterWindow:
|
||||||
if (user.show == 'offline' or user.show == 'error') and \
|
if (user.show == 'offline' or user.show == 'error') and \
|
||||||
not showOffline and (not _('Transports') in user.groups or \
|
not showOffline and (not _('Transports') in user.groups or \
|
||||||
gajim.connections[account].connected < 2) and \
|
gajim.connections[account].connected < 2) and \
|
||||||
not self.plugin.queues[account].has_key(user.jid):
|
not gajim.awaiting_messages[account].has_key(user.jid):
|
||||||
return
|
return
|
||||||
|
|
||||||
model = self.tree.get_model()
|
model = self.tree.get_model()
|
||||||
|
@ -135,12 +135,12 @@ class RosterWindow:
|
||||||
IterAcct = self.get_account_iter(account)
|
IterAcct = self.get_account_iter(account)
|
||||||
iterG = model.append(IterAcct,
|
iterG = model.append(IterAcct,
|
||||||
[self.jabber_state_images['closed'], g, 'group', g, account, False, None])
|
[self.jabber_state_images['closed'], g, 'group', g, account, False, None])
|
||||||
if not self.groups[account].has_key(g): #It can probably never append
|
if not gajim.groups[account].has_key(g): #It can probably never append
|
||||||
if account + g in self.collapsed_rows:
|
if account + g in self.collapsed_rows:
|
||||||
ishidden = False
|
ishidden = False
|
||||||
else:
|
else:
|
||||||
ishidden = True
|
ishidden = True
|
||||||
self.groups[account][g] = { 'expand': ishidden }
|
gajim.groups[account][g] = { 'expand': ishidden }
|
||||||
if not account in self.collapsed_rows and \
|
if not account in self.collapsed_rows and \
|
||||||
not gajim.config.get('mergeaccounts'):
|
not gajim.config.get('mergeaccounts'):
|
||||||
self.tree.expand_row((model.get_path(iterG)[0]), False)
|
self.tree.expand_row((model.get_path(iterG)[0]), False)
|
||||||
|
@ -152,18 +152,18 @@ class RosterWindow:
|
||||||
model.append(iterG, [self.jabber_state_images[user.show], user.name,
|
model.append(iterG, [self.jabber_state_images[user.show], user.name,
|
||||||
typestr, user.jid, account, False, None]) # FIXME None --> avatar
|
typestr, user.jid, account, False, None]) # FIXME None --> avatar
|
||||||
|
|
||||||
if self.groups[account][g]['expand']:
|
if gajim.groups[account][g]['expand']:
|
||||||
self.tree.expand_row(model.get_path(iterG),
|
self.tree.expand_row(model.get_path(iterG),
|
||||||
False)
|
False)
|
||||||
self.draw_contact(jid, account)
|
self.draw_contact(jid, account)
|
||||||
|
|
||||||
def really_remove_user(self, user, account):
|
def really_remove_user(self, user, account):
|
||||||
if user.jid in self.newly_added[account]:
|
if user.jid in gajim.newly_added[account]:
|
||||||
return
|
return
|
||||||
if user.jid.find('@') < 1 and gajim.connections[account].connected > 1: # It's an agent
|
if user.jid.find('@') < 1 and gajim.connections[account].connected > 1: # It's an agent
|
||||||
return
|
return
|
||||||
if user.jid in self.to_be_removed[account]:
|
if user.jid in gajim.to_be_removed[account]:
|
||||||
self.to_be_removed[account].remove(user.jid)
|
gajim.to_be_removed[account].remove(user.jid)
|
||||||
if gajim.config.get('showoffline'):
|
if gajim.config.get('showoffline'):
|
||||||
self.draw_contact(user.jid, account)
|
self.draw_contact(user.jid, account)
|
||||||
return
|
return
|
||||||
|
@ -171,7 +171,7 @@ class RosterWindow:
|
||||||
|
|
||||||
def remove_user(self, user, account):
|
def remove_user(self, user, account):
|
||||||
'''Remove a user from the roster'''
|
'''Remove a user from the roster'''
|
||||||
if user.jid in self.to_be_removed[account]:
|
if user.jid in gajim.to_be_removed[account]:
|
||||||
return
|
return
|
||||||
model = self.tree.get_model()
|
model = self.tree.get_model()
|
||||||
for i in self.get_contact_iter(user.jid, account):
|
for i in self.get_contact_iter(user.jid, account):
|
||||||
|
@ -182,12 +182,13 @@ class RosterWindow:
|
||||||
model.remove(parent_i)
|
model.remove(parent_i)
|
||||||
# We need to check all contacts, even offline contacts
|
# We need to check all contacts, even offline contacts
|
||||||
group_empty = True
|
group_empty = True
|
||||||
for jid in self.contacts[account]:
|
for jid in gajim.contacts[account]:
|
||||||
if group in self.contacts[account][jid][0].groups:
|
if group in gajim.contacts[account][jid][0].groups:
|
||||||
group_empty = False
|
group_empty = False
|
||||||
break
|
break
|
||||||
if group_empty:
|
if group_empty:
|
||||||
del self.groups[account][group]
|
del gajim.groups[account][group]
|
||||||
|
|
||||||
def get_transport_name_by_jid(self,jid):
|
def get_transport_name_by_jid(self,jid):
|
||||||
if not jid or not gajim.config.get('use_transports_iconsets'):
|
if not jid or not gajim.config.get('use_transports_iconsets'):
|
||||||
return None
|
return None
|
||||||
|
@ -224,7 +225,7 @@ class RosterWindow:
|
||||||
iters = self.get_contact_iter(jid, account)
|
iters = self.get_contact_iter(jid, account)
|
||||||
if len(iters) == 0:
|
if len(iters) == 0:
|
||||||
return
|
return
|
||||||
users = self.contacts[account][jid]
|
users = gajim.contacts[account][jid]
|
||||||
name = users[0].name
|
name = users[0].name
|
||||||
if len(users) > 1:
|
if len(users) > 1:
|
||||||
name += ' (' + str(len(users)) + ')'
|
name += ' (' + str(len(users)) + ')'
|
||||||
|
@ -236,7 +237,7 @@ class RosterWindow:
|
||||||
user = u
|
user = u
|
||||||
|
|
||||||
state_images = self.get_appropriate_state_images(jid)
|
state_images = self.get_appropriate_state_images(jid)
|
||||||
if self.plugin.queues[account].has_key(jid):
|
if gajim.awaiting_messages[account].has_key(jid):
|
||||||
img = state_images['message']
|
img = state_images['message']
|
||||||
elif jid.find('@') <= 0: # if not '@' or '@' starts the jid ==> agent
|
elif jid.find('@') <= 0: # if not '@' or '@' starts the jid ==> agent
|
||||||
img = state_images[user.show]
|
img = state_images[user.show]
|
||||||
|
@ -517,15 +518,15 @@ class RosterWindow:
|
||||||
self.tree.get_model().clear()
|
self.tree.get_model().clear()
|
||||||
for acct in gajim.connections:
|
for acct in gajim.connections:
|
||||||
self.add_account_to_roster(acct)
|
self.add_account_to_roster(acct)
|
||||||
for jid in self.contacts[acct].keys():
|
for jid in gajim.contacts[acct].keys():
|
||||||
self.add_contact_to_roster(jid, acct)
|
self.add_contact_to_roster(jid, acct)
|
||||||
|
|
||||||
def mklists(self, array, account):
|
def mklists(self, array, account):
|
||||||
'''fill self.contacts and self.groups'''
|
'''fill gajim.contacts and gajim.groups'''
|
||||||
if not self.contacts.has_key(account):
|
if not gajim.contacts.has_key(account):
|
||||||
self.contacts[account] = {}
|
gajim.contacts[account] = {}
|
||||||
if not self.groups.has_key(account):
|
if not gajim.groups.has_key(account):
|
||||||
self.groups[account] = {}
|
gajim.groups[account] = {}
|
||||||
for jid in array.keys():
|
for jid in array.keys():
|
||||||
jids = jid.split('/')
|
jids = jid.split('/')
|
||||||
#get jid
|
#get jid
|
||||||
|
@ -555,26 +556,26 @@ class RosterWindow:
|
||||||
|
|
||||||
# when we draw the roster, we avoid having the same contact
|
# when we draw the roster, we avoid having the same contact
|
||||||
# more than once (eg. we avoid showing it twice with 2 resources)
|
# more than once (eg. we avoid showing it twice with 2 resources)
|
||||||
self.contacts[account][ji] = [user1]
|
gajim.contacts[account][ji] = [user1]
|
||||||
for g in array[jid]['groups'] :
|
for g in array[jid]['groups'] :
|
||||||
if g in self.groups[account].keys():
|
if g in gajim.groups[account].keys():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if account + g in self.collapsed_rows:
|
if account + g in self.collapsed_rows:
|
||||||
ishidden = False
|
ishidden = False
|
||||||
else:
|
else:
|
||||||
ishidden = True
|
ishidden = True
|
||||||
self.groups[account][g] = { 'expand': ishidden }
|
gajim.groups[account][g] = { 'expand': ishidden }
|
||||||
|
|
||||||
def chg_contact_status(self, user, show, status, account):
|
def chg_contact_status(self, user, show, status, account):
|
||||||
'''When a contact changes his status'''
|
'''When a contact changes his status'''
|
||||||
showOffline = gajim.config.get('showoffline')
|
showOffline = gajim.config.get('showoffline')
|
||||||
model = self.tree.get_model()
|
model = self.tree.get_model()
|
||||||
luser = self.contacts[account][user.jid]
|
luser = gajim.contacts[account][user.jid]
|
||||||
user.show = show
|
user.show = show
|
||||||
user.status = status
|
user.status = status
|
||||||
if (show == 'offline' or show == 'error') and \
|
if (show == 'offline' or show == 'error') and \
|
||||||
not self.plugin.queues[account].has_key(user.jid):
|
not gajim.awaiting_messages[account].has_key(user.jid):
|
||||||
if len(luser) > 1:
|
if len(luser) > 1:
|
||||||
luser.remove(user)
|
luser.remove(user)
|
||||||
self.draw_contact(user.jid, account)
|
self.draw_contact(user.jid, account)
|
||||||
|
@ -640,7 +641,7 @@ class RosterWindow:
|
||||||
if self.tooltip.timeout == 0 or self.tooltip.path != props[0]:
|
if self.tooltip.timeout == 0 or self.tooltip.path != props[0]:
|
||||||
self.tooltip.path = row
|
self.tooltip.path = row
|
||||||
self.tooltip.timeout = gobject.timeout_add(500,
|
self.tooltip.timeout = gobject.timeout_add(500,
|
||||||
self.show_tooltip, self.contacts[account][jid])
|
self.show_tooltip, gajim.contacts[account][jid])
|
||||||
|
|
||||||
def on_agent_logging(self, widget, jid, state, account):
|
def on_agent_logging(self, widget, jid, state, account):
|
||||||
'''When an agent is requested to log in or off'''
|
'''When an agent is requested to log in or off'''
|
||||||
|
@ -659,14 +660,14 @@ class RosterWindow:
|
||||||
# remove transport from treeview
|
# remove transport from treeview
|
||||||
self.remove_user(contact, account)
|
self.remove_user(contact, account)
|
||||||
# remove transport's contacts from treeview
|
# remove transport's contacts from treeview
|
||||||
for jid, contacts in self.contacts[account].items():
|
for jid, contacts in gajim.contacts[account].items():
|
||||||
contact = contacts[0]
|
contact = contacts[0]
|
||||||
if jid.endswith('@' + contact.jid):
|
if jid.endswith('@' + contact.jid):
|
||||||
gajim.log.debug(
|
gajim.log.debug(
|
||||||
'Removing contact %s due to unregistered transport %s'\
|
'Removing contact %s due to unregistered transport %s'\
|
||||||
% (contact.jid, contact.name))
|
% (contact.jid, contact.name))
|
||||||
self.remove_user(contact, account)
|
self.remove_user(contact, account)
|
||||||
del self.contacts[account][contact.jid]
|
del gajim.contacts[account][contact.jid]
|
||||||
|
|
||||||
def on_rename(self, widget, iter, path):
|
def on_rename(self, widget, iter, path):
|
||||||
model = self.tree.get_model()
|
model = self.tree.get_model()
|
||||||
|
@ -694,7 +695,7 @@ class RosterWindow:
|
||||||
del keys[user.jid]
|
del keys[user.jid]
|
||||||
else:
|
else:
|
||||||
keys[user.jid] = keyID[0]
|
keys[user.jid] = keyID[0]
|
||||||
for u in self.contacts[account][user.jid]:
|
for u in gajim.contacts[account][user.jid]:
|
||||||
u.keyID = keyID[0]
|
u.keyID = keyID[0]
|
||||||
if self.plugin.windows[account]['chats'].has_key(user.jid):
|
if self.plugin.windows[account]['chats'].has_key(user.jid):
|
||||||
self.plugin.windows[account]['chats'][user.jid].draw_widgets(user)
|
self.plugin.windows[account]['chats'][user.jid].draw_widgets(user)
|
||||||
|
@ -724,7 +725,7 @@ class RosterWindow:
|
||||||
jid = model.get_value(iter, 3)
|
jid = model.get_value(iter, 3)
|
||||||
path = model.get_path(iter)
|
path = model.get_path(iter)
|
||||||
account = model.get_value(iter, 4)
|
account = model.get_value(iter, 4)
|
||||||
contact = self.contacts[account][jid][0]
|
contact = gajim.contacts[account][jid][0]
|
||||||
|
|
||||||
xml = gtk.glade.XML(GTKGUI_GLADE, 'roster_contact_context_menu',
|
xml = gtk.glade.XML(GTKGUI_GLADE, 'roster_contact_context_menu',
|
||||||
APP)
|
APP)
|
||||||
|
@ -818,14 +819,14 @@ class RosterWindow:
|
||||||
jid = model.get_value(iter, 3)
|
jid = model.get_value(iter, 3)
|
||||||
path = model.get_path(iter)
|
path = model.get_path(iter)
|
||||||
account = model.get_value(iter, 4)
|
account = model.get_value(iter, 4)
|
||||||
user = self.contacts[account][jid][0]
|
user = gajim.contacts[account][jid][0]
|
||||||
menu = gtk.Menu()
|
menu = gtk.Menu()
|
||||||
|
|
||||||
item = gtk.ImageMenuItem(_('_Log on'))
|
item = gtk.ImageMenuItem(_('_Log on'))
|
||||||
icon = gtk.image_new_from_stock(gtk.STOCK_YES, gtk.ICON_SIZE_MENU)
|
icon = gtk.image_new_from_stock(gtk.STOCK_YES, gtk.ICON_SIZE_MENU)
|
||||||
item.set_image(icon)
|
item.set_image(icon)
|
||||||
menu.append(item)
|
menu.append(item)
|
||||||
show = self.contacts[account][jid][0].show
|
show = gajim.contacts[account][jid][0].show
|
||||||
if show != 'offline' and show != 'error':
|
if show != 'offline' and show != 'error':
|
||||||
item.set_sensitive(False)
|
item.set_sensitive(False)
|
||||||
item.connect('activate', self.on_agent_logging, jid, None, account)
|
item.connect('activate', self.on_agent_logging, jid, None, account)
|
||||||
|
@ -961,7 +962,7 @@ class RosterWindow:
|
||||||
gajim.connections[account].request_subscription(jid, txt)
|
gajim.connections[account].request_subscription(jid, txt)
|
||||||
if not group:
|
if not group:
|
||||||
group = _('General')
|
group = _('General')
|
||||||
if not self.contacts[account].has_key(jid):
|
if not gajim.contacts[account].has_key(jid):
|
||||||
keyID = ''
|
keyID = ''
|
||||||
attached_keys = gajim.config.get_per('accounts', account,
|
attached_keys = gajim.config.get_per('accounts', account,
|
||||||
'attached_gpg_keys').split()
|
'attached_gpg_keys').split()
|
||||||
|
@ -970,9 +971,9 @@ class RosterWindow:
|
||||||
user1 = Contact(jid = jid, name = pseudo, groups = [group],
|
user1 = Contact(jid = jid, name = pseudo, groups = [group],
|
||||||
show = 'requested', status = 'requested', ask = 'none',
|
show = 'requested', status = 'requested', ask = 'none',
|
||||||
sub = 'subscribe', keyID = keyID)
|
sub = 'subscribe', keyID = keyID)
|
||||||
self.contacts[account][jid] = [user1]
|
gajim.contacts[account][jid] = [user1]
|
||||||
else:
|
else:
|
||||||
user1 = self.contacts[account][jid][0]
|
user1 = gajim.contacts[account][jid][0]
|
||||||
if not _('not in the roster') in user1.groups:
|
if not _('not in the roster') in user1.groups:
|
||||||
dialogs.InformationDialog(_('Subscription request has been sent'),
|
dialogs.InformationDialog(_('Subscription request has been sent'),
|
||||||
_('If "%s" accepts this request you will know his status.') %jid).get_response()
|
_('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
|
@ -1010,7 +1011,7 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
jid = model.get_value(iter, 3)
|
jid = model.get_value(iter, 3)
|
||||||
account = model.get_value(iter, 4)
|
account = model.get_value(iter, 4)
|
||||||
type = model.get_value(iter, 2)
|
type = model.get_value(iter, 2)
|
||||||
user = self.contacts[account][jid][0]
|
user = gajim.contacts[account][jid][0]
|
||||||
if type == 'contact':
|
if type == 'contact':
|
||||||
self.on_req_usub(widget, user, account)
|
self.on_req_usub(widget, user, account)
|
||||||
elif type == 'agent':
|
elif type == 'agent':
|
||||||
|
@ -1074,8 +1075,8 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
jid = model.get_value(iter, 3)
|
jid = model.get_value(iter, 3)
|
||||||
if self.plugin.windows[account]['chats'].has_key(jid):
|
if self.plugin.windows[account]['chats'].has_key(jid):
|
||||||
self.plugin.windows[account]['chats'][jid].set_active_tab(jid)
|
self.plugin.windows[account]['chats'][jid].set_active_tab(jid)
|
||||||
elif self.contacts[account].has_key(jid):
|
elif gajim.contacts[account].has_key(jid):
|
||||||
self.new_chat(self.contacts[account][jid][0], account)
|
self.new_chat(gajim.contacts[account][jid][0], account)
|
||||||
self.plugin.windows[account]['chats'][jid].set_active_tab(jid)
|
self.plugin.windows[account]['chats'][jid].set_active_tab(jid)
|
||||||
self.plugin.windows[account]['chats'][jid].window.present()
|
self.plugin.windows[account]['chats'][jid].window.present()
|
||||||
return True
|
return True
|
||||||
|
@ -1103,14 +1104,14 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
_('By removing this contact you also remove authorization. Contact "%s" will always see you as offline.') % user.name)
|
_('By removing this contact you also remove authorization. Contact "%s" will always see you as offline.') % user.name)
|
||||||
if window.get_response() == gtk.RESPONSE_OK:
|
if window.get_response() == gtk.RESPONSE_OK:
|
||||||
gajim.connections[account].unsubscribe(user.jid)
|
gajim.connections[account].unsubscribe(user.jid)
|
||||||
for u in self.contacts[account][user.jid]:
|
for u in gajim.contacts[account][user.jid]:
|
||||||
self.remove_user(u, account)
|
self.remove_user(u, account)
|
||||||
del self.contacts[account][u.jid]
|
del gajim.contacts[account][u.jid]
|
||||||
if user.jid in self.plugin.windows[account]['chats']:
|
if user.jid in self.plugin.windows[account]['chats']:
|
||||||
user1 = Contact(jid = user.jid, name = user.name,
|
user1 = Contact(jid = user.jid, name = user.name,
|
||||||
groups = [_('not in the roster')], show = _('not in the roster'),
|
groups = [_('not in the roster')], show = _('not in the roster'),
|
||||||
status = _('not in the roster'), ask = 'none', keyID = user.keyID)
|
status = _('not in the roster'), ask = 'none', keyID = user.keyID)
|
||||||
self.contacts[account][user.jid] = [user1]
|
gajim.contacts[account][user.jid] = [user1]
|
||||||
self.add_contact_to_roster(user.jid, account)
|
self.add_contact_to_roster(user.jid, account)
|
||||||
|
|
||||||
def forget_gpg_passphrase(self, keyid):
|
def forget_gpg_passphrase(self, keyid):
|
||||||
|
@ -1187,9 +1188,9 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
txt)
|
txt)
|
||||||
if status == 'online' and self.plugin.sleeper.getState() != \
|
if status == 'online' and self.plugin.sleeper.getState() != \
|
||||||
common.sleepy.STATE_UNKNOWN:
|
common.sleepy.STATE_UNKNOWN:
|
||||||
self.plugin.sleeper_state[account] = 1
|
gajim.sleeper_state[account] = 1
|
||||||
else:
|
else:
|
||||||
self.plugin.sleeper_state[account] = 0
|
gajim.sleeper_state[account] = 0
|
||||||
|
|
||||||
def get_status_message(self, show):
|
def get_status_message(self, show):
|
||||||
if (show == 'online' and not gajim.config.get('ask_online_status')) or \
|
if (show == 'online' and not gajim.config.get('ask_online_status')) or \
|
||||||
|
@ -1254,15 +1255,15 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
|
|
||||||
def on_status_changed(self, account, status):
|
def on_status_changed(self, account, status):
|
||||||
'''the core tells us that our status has changed'''
|
'''the core tells us that our status has changed'''
|
||||||
if not self.contacts.has_key(account):
|
if not gajim.contacts.has_key(account):
|
||||||
return
|
return
|
||||||
model = self.tree.get_model()
|
model = self.tree.get_model()
|
||||||
accountIter = self.get_account_iter(account)
|
accountIter = self.get_account_iter(account)
|
||||||
if accountIter:
|
if accountIter:
|
||||||
model.set_value(accountIter, 0, self.jabber_state_images[status])
|
model.set_value(accountIter, 0, self.jabber_state_images[status])
|
||||||
if status == 'offline':
|
if status == 'offline':
|
||||||
for jid in self.contacts[account]:
|
for jid in gajim.contacts[account]:
|
||||||
luser = self.contacts[account][jid]
|
luser = gajim.contacts[account][jid]
|
||||||
luser_copy = []
|
luser_copy = []
|
||||||
for user in luser:
|
for user in luser:
|
||||||
luser_copy.append(user)
|
luser_copy.append(user)
|
||||||
|
@ -1286,8 +1287,8 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
tabbed_chat_window.TabbedChatWindow(user, self.plugin, account)
|
tabbed_chat_window.TabbedChatWindow(user, self.plugin, account)
|
||||||
|
|
||||||
def new_chat_from_jid(self, account, jid):
|
def new_chat_from_jid(self, account, jid):
|
||||||
if self.contacts[account].has_key(jid):
|
if gajim.contacts[account].has_key(jid):
|
||||||
user = self.contacts[account][jid][0]
|
user = gajim.contacts[account][jid][0]
|
||||||
else:
|
else:
|
||||||
keyID = ''
|
keyID = ''
|
||||||
attached_keys = gajim.config.get_per('accounts', account,
|
attached_keys = gajim.config.get_per('accounts', account,
|
||||||
|
@ -1297,7 +1298,7 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
user = Contact(jid = jid, name = jid.split('@')[0],
|
user = Contact(jid = jid, name = jid.split('@')[0],
|
||||||
groups = [_('not in the roster')], show = _('not in the roster'),
|
groups = [_('not in the roster')], show = _('not in the roster'),
|
||||||
status = _('not in the roster'), sub = 'none', keyID = keyID)
|
status = _('not in the roster'), sub = 'none', keyID = keyID)
|
||||||
self.contacts[account][jid] = [user]
|
gajim.contacts[account][jid] = [user]
|
||||||
self.add_contact_to_roster(user.jid, account)
|
self.add_contact_to_roster(user.jid, account)
|
||||||
|
|
||||||
if not self.plugin.windows[account]['chats'].has_key(jid):
|
if not self.plugin.windows[account]['chats'].has_key(jid):
|
||||||
|
@ -1322,7 +1323,7 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
def on_message(self, jid, msg, tim, account, encrypted = False,\
|
def on_message(self, jid, msg, tim, account, encrypted = False,\
|
||||||
msg_type = '', subject = None):
|
msg_type = '', subject = None):
|
||||||
'''when we receive a message'''
|
'''when we receive a message'''
|
||||||
if not self.contacts[account].has_key(jid):
|
if not gajim.contacts[account].has_key(jid):
|
||||||
keyID = ''
|
keyID = ''
|
||||||
attached_keys = gajim.config.get_per('accounts', account,
|
attached_keys = gajim.config.get_per('accounts', account,
|
||||||
'attached_gpg_keys').split()
|
'attached_gpg_keys').split()
|
||||||
|
@ -1331,7 +1332,7 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
user1 = Contact(jid = jid, name = jid.split('@')[0],
|
user1 = Contact(jid = jid, name = jid.split('@')[0],
|
||||||
groups = [_('not in the roster')], show = _('not in the roster'),
|
groups = [_('not in the roster')], show = _('not in the roster'),
|
||||||
status = _('not in the roster'), ask = 'none', keyID = keyID)
|
status = _('not in the roster'), ask = 'none', keyID = keyID)
|
||||||
self.contacts[account][jid] = [user1]
|
gajim.contacts[account][jid] = [user1]
|
||||||
self.add_contact_to_roster(jid, account)
|
self.add_contact_to_roster(jid, account)
|
||||||
|
|
||||||
iters = self.get_contact_iter(jid, account)
|
iters = self.get_contact_iter(jid, account)
|
||||||
|
@ -1346,13 +1347,13 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
if msg_type == 'normal': # it's single message
|
if msg_type == 'normal': # it's single message
|
||||||
#FIXME: take into account autopopup and autopopupaway
|
#FIXME: take into account autopopup and autopopupaway
|
||||||
# if user doesn't want to be bugged do it as we do the 'chat'
|
# if user doesn't want to be bugged do it as we do the 'chat'
|
||||||
contact = self.contacts[account][jid][0]
|
contact = gajim.contacts[account][jid][0]
|
||||||
dialogs.SingleMessageWindow(self.plugin, account, contact,
|
dialogs.SingleMessageWindow(self.plugin, account, contact,
|
||||||
action = 'receive', from_whom = jid, subject = subject, message = msg)
|
action = 'receive', from_whom = jid, subject = subject, message = msg)
|
||||||
return
|
return
|
||||||
|
|
||||||
# Do we have a queue?
|
# Do we have a queue?
|
||||||
qs = self.plugin.queues[account]
|
qs = gajim.awaiting_messages[account]
|
||||||
no_queue = True
|
no_queue = True
|
||||||
if qs.has_key(jid):
|
if qs.has_key(jid):
|
||||||
no_queue = False
|
no_queue = False
|
||||||
|
@ -1385,7 +1386,7 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
self.tree.set_cursor(path)
|
self.tree.set_cursor(path)
|
||||||
else:
|
else:
|
||||||
if not self.plugin.windows[account]['chats'].has_key(jid):
|
if not self.plugin.windows[account]['chats'].has_key(jid):
|
||||||
self.new_chat(self.contacts[account][jid][0], account)
|
self.new_chat(gajim.contacts[account][jid][0], account)
|
||||||
if path:
|
if path:
|
||||||
self.tree.expand_row(path[0:1], False)
|
self.tree.expand_row(path[0:1], False)
|
||||||
self.tree.expand_row(path[0:2], False)
|
self.tree.expand_row(path[0:2], False)
|
||||||
|
@ -1540,8 +1541,8 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
else:
|
else:
|
||||||
if self.plugin.windows[account]['chats'].has_key(jid):
|
if self.plugin.windows[account]['chats'].has_key(jid):
|
||||||
self.plugin.windows[account]['chats'][jid].set_active_tab(jid)
|
self.plugin.windows[account]['chats'][jid].set_active_tab(jid)
|
||||||
elif self.contacts[account].has_key(jid):
|
elif gajim.contacts[account].has_key(jid):
|
||||||
self.new_chat(self.contacts[account][jid][0], account)
|
self.new_chat(gajim.contacts[account][jid][0], account)
|
||||||
self.plugin.windows[account]['chats'][jid].set_active_tab(jid)
|
self.plugin.windows[account]['chats'][jid].set_active_tab(jid)
|
||||||
self.plugin.windows[account]['chats'][jid].window.present()
|
self.plugin.windows[account]['chats'][jid].window.present()
|
||||||
|
|
||||||
|
@ -1557,21 +1558,20 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
model.set_value(iter, 0, self.jabber_state_images['opened'])
|
model.set_value(iter, 0, self.jabber_state_images['opened'])
|
||||||
jid = model.get_value(iter, 3)
|
jid = model.get_value(iter, 3)
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
if self.groups[account].has_key(jid): # This account has this group
|
if gajim.groups[account].has_key(jid): # This account has this group
|
||||||
self.groups[account][jid]['expand'] = True
|
gajim.groups[account][jid]['expand'] = True
|
||||||
if account + jid in self.collapsed_rows:
|
if account + jid in self.collapsed_rows:
|
||||||
self.collapsed_rows.remove(account + jid)
|
self.collapsed_rows.remove(account + jid)
|
||||||
elif type == 'account':
|
elif type == 'account':
|
||||||
account = accounts[0] # There is only one cause we don't use merge
|
account = accounts[0] # There is only one cause we don't use merge
|
||||||
if account in self.collapsed_rows:
|
if account in self.collapsed_rows:
|
||||||
self.collapsed_rows.remove(account)
|
self.collapsed_rows.remove(account)
|
||||||
for g in self.groups[account]:
|
for g in gajim.groups[account]:
|
||||||
groupIter = self.get_group_iter(g, account)
|
groupIter = self.get_group_iter(g, account)
|
||||||
if groupIter and self.groups[account][g]['expand']:
|
if groupIter and gajim.groups[account][g]['expand']:
|
||||||
pathG = model.get_path(groupIter)
|
pathG = model.get_path(groupIter)
|
||||||
self.tree.expand_row(pathG, False)
|
self.tree.expand_row(pathG, False)
|
||||||
|
|
||||||
|
|
||||||
def on_roster_treeview_row_collapsed(self, widget, iter, path):
|
def on_roster_treeview_row_collapsed(self, widget, iter, path):
|
||||||
'''When a row is collapsed :
|
'''When a row is collapsed :
|
||||||
change the icon of the arrow'''
|
change the icon of the arrow'''
|
||||||
|
@ -1585,8 +1585,8 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
model.set_value(iter, 0, self.jabber_state_images['closed'])
|
model.set_value(iter, 0, self.jabber_state_images['closed'])
|
||||||
jid = model.get_value(iter, 3)
|
jid = model.get_value(iter, 3)
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
if self.groups[account].has_key(jid): # This account has this group
|
if gajim.groups[account].has_key(jid): # This account has this group
|
||||||
self.groups[account][jid]['expand'] = False
|
gajim.groups[account][jid]['expand'] = False
|
||||||
if not account + jid in self.collapsed_rows:
|
if not account + jid in self.collapsed_rows:
|
||||||
self.collapsed_rows.append(account + jid)
|
self.collapsed_rows.append(account + jid)
|
||||||
elif type == 'account':
|
elif type == 'account':
|
||||||
|
@ -1610,17 +1610,17 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
jid = model.get_value(iter, 3)
|
jid = model.get_value(iter, 3)
|
||||||
type = model.get_value(iter, 2)
|
type = model.get_value(iter, 2)
|
||||||
if type == 'contact':
|
if type == 'contact':
|
||||||
old_text = self.contacts[account][jid][0].name
|
old_text = gajim.contacts[account][jid][0].name
|
||||||
if old_text != new_text:
|
if old_text != new_text:
|
||||||
for u in self.contacts[account][jid]:
|
for u in gajim.contacts[account][jid]:
|
||||||
u.name = new_text
|
u.name = new_text
|
||||||
gajim.connections[account].update_contact(jid, new_text, u.groups)
|
gajim.connections[account].update_contact(jid, new_text, u.groups)
|
||||||
self.draw_contact(jid, account)
|
self.draw_contact(jid, account)
|
||||||
elif type == 'group':
|
elif type == 'group':
|
||||||
old_name = model.get_value(iter, 1)
|
old_name = model.get_value(iter, 1)
|
||||||
#get all users in that group
|
#get all users in that group
|
||||||
for jid in self.contacts[account]:
|
for jid in gajim.contacts[account]:
|
||||||
user = self.contacts[account][jid][0]
|
user = gajim.contacts[account][jid][0]
|
||||||
if old_name in user.groups:
|
if old_name in user.groups:
|
||||||
#set them in the new one and remove it from the old
|
#set them in the new one and remove it from the old
|
||||||
self.remove_user(user, account)
|
self.remove_user(user, account)
|
||||||
|
@ -1723,9 +1723,9 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
else:
|
else:
|
||||||
jid = model.get_value(iter, 3)
|
jid = model.get_value(iter, 3)
|
||||||
account = model.get_value(iter, 4)
|
account = model.get_value(iter, 4)
|
||||||
if jid in self.newly_added[account]:
|
if jid in gajim.newly_added[account]:
|
||||||
renderer.set_property('cell-background', '#adc3c6')
|
renderer.set_property('cell-background', '#adc3c6')
|
||||||
elif jid in self.to_be_removed[account]:
|
elif jid in gajim.to_be_removed[account]:
|
||||||
renderer.set_property('cell-background', '#ab6161')
|
renderer.set_property('cell-background', '#ab6161')
|
||||||
else:
|
else:
|
||||||
renderer.set_property('cell-background',
|
renderer.set_property('cell-background',
|
||||||
|
@ -1758,9 +1758,9 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
account = model.get_value(iter, 4)
|
account = model.get_value(iter, 4)
|
||||||
renderer.set_property('foreground',
|
renderer.set_property('foreground',
|
||||||
gajim.config.get_per('themes', theme, 'contacttextcolor'))
|
gajim.config.get_per('themes', theme, 'contacttextcolor'))
|
||||||
if jid in self.newly_added[account]:
|
if jid in gajim.newly_added[account]:
|
||||||
renderer.set_property('cell-background', '#adc3c6')
|
renderer.set_property('cell-background', '#adc3c6')
|
||||||
elif jid in self.to_be_removed[account]:
|
elif jid in gajim.to_be_removed[account]:
|
||||||
renderer.set_property('cell-background', '#ab6161')
|
renderer.set_property('cell-background', '#ab6161')
|
||||||
else:
|
else:
|
||||||
renderer.set_property('cell-background',
|
renderer.set_property('cell-background',
|
||||||
|
@ -1781,9 +1781,9 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
else:
|
else:
|
||||||
jid = model.get_value(iter, 3)
|
jid = model.get_value(iter, 3)
|
||||||
account = model.get_value(iter, 4)
|
account = model.get_value(iter, 4)
|
||||||
if jid in self.newly_added[account]:
|
if jid in gajim.newly_added[account]:
|
||||||
renderer.set_property('cell-background', '#adc3c6')
|
renderer.set_property('cell-background', '#adc3c6')
|
||||||
elif jid in self.to_be_removed[account]:
|
elif jid in gajim.to_be_removed[account]:
|
||||||
renderer.set_property('cell-background', '#ab6161')
|
renderer.set_property('cell-background', '#ab6161')
|
||||||
else:
|
else:
|
||||||
renderer.set_property('cell-background',
|
renderer.set_property('cell-background',
|
||||||
|
@ -1823,8 +1823,8 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
if account and model.get_value(iter2, 4) == account:
|
if account and model.get_value(iter2, 4) == account:
|
||||||
jid1 = model.get_value(iter1, 3)
|
jid1 = model.get_value(iter1, 3)
|
||||||
jid2 = model.get_value(iter2, 3)
|
jid2 = model.get_value(iter2, 3)
|
||||||
luser1 = self.contacts[account][jid1]
|
luser1 = gajim.contacts[account][jid1]
|
||||||
luser2 = self.contacts[account][jid2]
|
luser2 = gajim.contacts[account][jid2]
|
||||||
cshow = {'online':0, 'chat': 1, 'away': 2, 'xa': 3, 'dnd': 4,
|
cshow = {'online':0, 'chat': 1, 'away': 2, 'xa': 3, 'dnd': 4,
|
||||||
'invisible': 5, 'offline': 6, _('not in the roster'): 7, 'error': 8}
|
'invisible': 5, 'offline': 6, _('not in the roster'): 7, 'error': 8}
|
||||||
s = self.get_show(luser1)
|
s = self.get_show(luser1)
|
||||||
|
@ -1897,18 +1897,18 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
return
|
return
|
||||||
# We upgrade only the first user because user2.groups is a pointer to
|
# We upgrade only the first user because user2.groups is a pointer to
|
||||||
# user1.groups
|
# user1.groups
|
||||||
u = self.contacts[account][data][0]
|
u = gajim.contacts[account][data][0]
|
||||||
u.groups.remove(grp_source)
|
u.groups.remove(grp_source)
|
||||||
if model.iter_n_children(iter_group_source) == 1: #this was the only child
|
if model.iter_n_children(iter_group_source) == 1: #this was the only child
|
||||||
model.remove(iter_group_source)
|
model.remove(iter_group_source)
|
||||||
#delete the group if it is empty (need to look for offline users too)
|
#delete the group if it is empty (need to look for offline users too)
|
||||||
group_empty = True
|
group_empty = True
|
||||||
for jid in self.contacts[account]:
|
for jid in gajim.contacts[account]:
|
||||||
if grp_source in self.contacts[account][jid][0].groups:
|
if grp_source in gajim.contacts[account][jid][0].groups:
|
||||||
group_empty = False
|
group_empty = False
|
||||||
break
|
break
|
||||||
if group_empty:
|
if group_empty:
|
||||||
del self.groups[account][grp_source]
|
del gajim.groups[account][grp_source]
|
||||||
if not grp_dest in u.groups:
|
if not grp_dest in u.groups:
|
||||||
u.groups.append(grp_dest)
|
u.groups.append(grp_dest)
|
||||||
self.add_contact_to_roster(data, account)
|
self.add_contact_to_roster(data, account)
|
||||||
|
@ -1947,20 +1947,9 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response()
|
||||||
self.window.resize(gajim.config.get('width'),
|
self.window.resize(gajim.config.get('width'),
|
||||||
gajim.config.get('height'))
|
gajim.config.get('height'))
|
||||||
|
|
||||||
self.groups = {}
|
|
||||||
# contacts[account][jid] is a list of all Contact instances:
|
|
||||||
# one per resource
|
|
||||||
self.contacts = {}
|
|
||||||
self.newly_added = {}
|
|
||||||
self.to_be_removed = {}
|
|
||||||
self.popups_notification_height = 0
|
self.popups_notification_height = 0
|
||||||
self.popup_notification_windows = []
|
self.popup_notification_windows = []
|
||||||
self.gpg_passphrase = {}
|
self.gpg_passphrase = {}
|
||||||
for a in gajim.connections:
|
|
||||||
self.contacts[a] = {}
|
|
||||||
self.groups[a] = {}
|
|
||||||
self.newly_added[a] = []
|
|
||||||
self.to_be_removed[a] = []
|
|
||||||
#(icon, name, type, jid, account, editable, secondary_pixbuf)
|
#(icon, name, type, jid, account, editable, secondary_pixbuf)
|
||||||
model = gtk.TreeStore(gtk.Image, str, str, str, str, bool, gtk.gdk.Pixbuf)
|
model = gtk.TreeStore(gtk.Image, str, str, str, str, bool, gtk.gdk.Pixbuf)
|
||||||
model.set_sort_func(1, self.compareIters)
|
model.set_sort_func(1, self.compareIters)
|
||||||
|
|
|
@ -108,9 +108,9 @@ class Systray:
|
||||||
if self.plugin.windows[account]['chats'].has_key(jid):
|
if self.plugin.windows[account]['chats'].has_key(jid):
|
||||||
self.plugin.windows[account]['chats'][jid].window.present()
|
self.plugin.windows[account]['chats'][jid].window.present()
|
||||||
self.plugin.windows[account]['chats'][jid].set_active_tab(jid)
|
self.plugin.windows[account]['chats'][jid].set_active_tab(jid)
|
||||||
elif self.plugin.roster.contacts[account].has_key(jid):
|
elif gajim.contacts[account].has_key(jid):
|
||||||
self.plugin.roster.new_chat(
|
self.plugin.roster.new_chat(
|
||||||
self.plugin.roster.contacts[account][jid][0], account)
|
gajim.contacts[account][jid][0], account)
|
||||||
self.plugin.windows[account]['chats'][jid].set_active_tab(jid)
|
self.plugin.windows[account]['chats'][jid].set_active_tab(jid)
|
||||||
|
|
||||||
def on_new_message_menuitem_activate(self, widget, account):
|
def on_new_message_menuitem_activate(self, widget, account):
|
||||||
|
@ -204,7 +204,7 @@ class Systray:
|
||||||
def make_groups_submenus_for_chat_with(self, account):
|
def make_groups_submenus_for_chat_with(self, account):
|
||||||
groups_menu = gtk.Menu()
|
groups_menu = gtk.Menu()
|
||||||
|
|
||||||
for group in self.plugin.roster.groups[account].keys():
|
for group in gajim.groups[account].keys():
|
||||||
if group == _('Transports'):
|
if group == _('Transports'):
|
||||||
continue
|
continue
|
||||||
# at least one 'not offline' or 'without errors' in this group
|
# at least one 'not offline' or 'without errors' in this group
|
||||||
|
@ -213,7 +213,7 @@ class Systray:
|
||||||
groups_menu.append(item)
|
groups_menu.append(item)
|
||||||
contacts_menu = gtk.Menu()
|
contacts_menu = gtk.Menu()
|
||||||
item.set_submenu(contacts_menu)
|
item.set_submenu(contacts_menu)
|
||||||
for users in self.plugin.roster.contacts[account].values():
|
for users in gajim.contacts[account].values():
|
||||||
user = users[0]
|
user = users[0]
|
||||||
if group in user.groups and user.show != 'offline' and \
|
if group in user.groups and user.show != 'offline' and \
|
||||||
user.show != 'error':
|
user.show != 'error':
|
||||||
|
@ -252,7 +252,7 @@ class Systray:
|
||||||
w = acc['chats'][jid]
|
w = acc['chats'][jid]
|
||||||
else:
|
else:
|
||||||
self.plugin.roster.new_chat(
|
self.plugin.roster.new_chat(
|
||||||
self.plugin.roster.contacts[account][jid][0], account)
|
gajim.contacts[account][jid][0], account)
|
||||||
acc['chats'][jid].set_active_tab(jid)
|
acc['chats'][jid].set_active_tab(jid)
|
||||||
acc['chats'][jid].window.present()
|
acc['chats'][jid].window.present()
|
||||||
if w:
|
if w:
|
||||||
|
|
|
@ -154,8 +154,8 @@ class TabbedChatWindow(chat.Chat):
|
||||||
|
|
||||||
def set_state_image(self, jid):
|
def set_state_image(self, jid):
|
||||||
prio = 0
|
prio = 0
|
||||||
if self.plugin.roster.contacts[self.account].has_key(jid):
|
if gajim.contacts[self.account].has_key(jid):
|
||||||
list_users = self.plugin.roster.contacts[self.account][jid]
|
list_users = gajim.contacts[self.account][jid]
|
||||||
else:
|
else:
|
||||||
list_users = [self.users[jid]]
|
list_users = [self.users[jid]]
|
||||||
user = list_users[0]
|
user = list_users[0]
|
||||||
|
@ -270,7 +270,7 @@ class TabbedChatWindow(chat.Chat):
|
||||||
self.restore_conversation(user.jid)
|
self.restore_conversation(user.jid)
|
||||||
|
|
||||||
#print queued messages
|
#print queued messages
|
||||||
if self.plugin.queues[self.account].has_key(user.jid):
|
if gajim.awaiting_messages[self.account].has_key(user.jid):
|
||||||
self.read_queue(user.jid)
|
self.read_queue(user.jid)
|
||||||
|
|
||||||
gajim.connections[self.account].request_vcard(user.jid)
|
gajim.connections[self.account].request_vcard(user.jid)
|
||||||
|
@ -362,21 +362,21 @@ class TabbedChatWindow(chat.Chat):
|
||||||
|
|
||||||
def read_queue(self, jid):
|
def read_queue(self, jid):
|
||||||
"""read queue and print messages containted in it"""
|
"""read queue and print messages containted in it"""
|
||||||
l = self.plugin.queues[self.account][jid]
|
l = gajim.awaiting_messages[self.account][jid]
|
||||||
user = self.users[jid]
|
user = self.users[jid]
|
||||||
for event in l:
|
for event in l:
|
||||||
self.print_conversation(event[0], jid, tim = event[1],
|
self.print_conversation(event[0], jid, tim = event[1],
|
||||||
encrypted = event[2])
|
encrypted = event[2])
|
||||||
self.plugin.roster.nb_unread -= 1
|
self.plugin.roster.nb_unread -= 1
|
||||||
self.plugin.roster.show_title()
|
self.plugin.roster.show_title()
|
||||||
del self.plugin.queues[self.account][jid]
|
del gajim.awaiting_messages[self.account][jid]
|
||||||
self.plugin.roster.draw_contact(jid, self.account)
|
self.plugin.roster.draw_contact(jid, self.account)
|
||||||
if self.plugin.systray_enabled:
|
if self.plugin.systray_enabled:
|
||||||
self.plugin.systray.remove_jid(jid, self.account)
|
self.plugin.systray.remove_jid(jid, self.account)
|
||||||
showOffline = gajim.config.get('showoffline')
|
showOffline = gajim.config.get('showoffline')
|
||||||
if (user.show == 'offline' or user.show == 'error') and \
|
if (user.show == 'offline' or user.show == 'error') and \
|
||||||
not showOffline:
|
not showOffline:
|
||||||
if len(self.plugin.roster.contacts[self.account][jid]) == 1:
|
if len(gajim.contacts[self.account][jid]) == 1:
|
||||||
self.plugin.roster.really_remove_user(user, self.account)
|
self.plugin.roster.really_remove_user(user, self.account)
|
||||||
|
|
||||||
def print_conversation(self, text, jid, contact = '', tim = None,
|
def print_conversation(self, text, jid, contact = '', tim = None,
|
||||||
|
@ -404,7 +404,7 @@ class TabbedChatWindow(chat.Chat):
|
||||||
self.xmls[jid].get_widget('gpg_togglebutton').set_active(encrypted)
|
self.xmls[jid].get_widget('gpg_togglebutton').set_active(encrypted)
|
||||||
if contact:
|
if contact:
|
||||||
kind = 'outgoing'
|
kind = 'outgoing'
|
||||||
name = self.plugin.nicks[self.account]
|
name = gajim.nicks[self.account]
|
||||||
else:
|
else:
|
||||||
kind = 'incoming'
|
kind = 'incoming'
|
||||||
name = user.name
|
name = user.name
|
||||||
|
@ -431,8 +431,8 @@ class TabbedChatWindow(chat.Chat):
|
||||||
count = gajim.logger.get_nb_line(jid)
|
count = gajim.logger.get_nb_line(jid)
|
||||||
|
|
||||||
|
|
||||||
if self.plugin.queues[self.account].has_key(jid):
|
if gajim.awaiting_messages[self.account].has_key(jid):
|
||||||
pos = len(self.plugin.queues[self.account][jid])
|
pos = len(gajim.awaiting_messages[self.account][jid])
|
||||||
else:
|
else:
|
||||||
pos = 0
|
pos = 0
|
||||||
|
|
||||||
|
@ -461,7 +461,7 @@ class TabbedChatWindow(chat.Chat):
|
||||||
for msg in lines:
|
for msg in lines:
|
||||||
if msg[1] == 'sent':
|
if msg[1] == 'sent':
|
||||||
kind = 'outgoing'
|
kind = 'outgoing'
|
||||||
name = self.plugin.nicks[self.account]
|
name = gajim.nicks[self.account]
|
||||||
elif msg[1] == 'recv':
|
elif msg[1] == 'recv':
|
||||||
kind = 'incoming'
|
kind = 'incoming'
|
||||||
name = self.users[jid].name
|
name = self.users[jid].name
|
||||||
|
|
|
@ -275,8 +275,8 @@ class VcardWindow:
|
||||||
self.os_info = {0: {'resource': self.user.resource, 'client': '',
|
self.os_info = {0: {'resource': self.user.resource, 'client': '',
|
||||||
'os': ''}}
|
'os': ''}}
|
||||||
i = 1
|
i = 1
|
||||||
if self.plugin.roster.contacts[self.account].has_key(self.user.jid):
|
if gajim.contacts[self.account].has_key(self.user.jid):
|
||||||
for u in self.plugin.roster.contacts[self.account][self.user.jid]:
|
for u in gajim.contacts[self.account][self.user.jid]:
|
||||||
if u.resource != self.user.resource:
|
if u.resource != self.user.resource:
|
||||||
resources += '\n' + u.resource + ' (' + str(u.priority) + ')'
|
resources += '\n' + u.resource + ' (' + str(u.priority) + ')'
|
||||||
if not u.status:
|
if not u.status:
|
||||||
|
@ -365,7 +365,7 @@ class VcardWindow:
|
||||||
nick = vcard['NICKNAME']
|
nick = vcard['NICKNAME']
|
||||||
if nick == '':
|
if nick == '':
|
||||||
nick = gajim.config.get_per('accounts', self.account, 'name')
|
nick = gajim.config.get_per('accounts', self.account, 'name')
|
||||||
self.plugin.nicks[self.account] = nick
|
gajim.nicks[self.account] = nick
|
||||||
gajim.connections[self.account].send_vcard(vcard)
|
gajim.connections[self.account].send_vcard(vcard)
|
||||||
|
|
||||||
def on_retrieve_button_clicked(self, widget):
|
def on_retrieve_button_clicked(self, widget):
|
||||||
|
|
Loading…
Add table
Reference in a new issue