We now (hopefully) know the windows version. Yann have a look on get_contacts_list, and on get_os returning N/A for MSN,ICQ stuff but that also does not work
This commit is contained in:
parent
ec34b733c4
commit
90975dd1e0
13
Core/core.py
13
Core/core.py
|
@ -64,7 +64,16 @@ distro_info = {
|
|||
|
||||
def get_os_info():
|
||||
if os.name =='nt':
|
||||
return 'windows'
|
||||
win_version = {
|
||||
(1, 4, 0): "95",\
|
||||
(1, 4, 10): "98",\
|
||||
(1, 4, 90): "ME",\
|
||||
(2, 4, 0): "NT",\
|
||||
(2, 5, 0): "2000",\
|
||||
(2, 5, 1): "XP"
|
||||
}[os.sys.getwindowsversion()[3], os.sys.getwindowsversion()[0],\
|
||||
os.sys.getwindowsversion()[1]]
|
||||
return 'Windows' + ' ' + win_version
|
||||
elif os.name =='posix':
|
||||
executable = 'lsb_release'
|
||||
params = ' --id --codename --release --short'
|
||||
|
@ -87,7 +96,7 @@ def get_os_info():
|
|||
if path_to_file.endswith('version'):
|
||||
text = distro + ' ' + text
|
||||
return text
|
||||
return ''
|
||||
return 'N/A'
|
||||
|
||||
def XMLescape(txt):
|
||||
"Escape XML entities"
|
||||
|
|
|
@ -637,7 +637,7 @@ class Chat:
|
|||
#we are at the end or we are sending something
|
||||
end = True
|
||||
# We scroll to the end after the scrollbar has appeared
|
||||
gobject.timeout_add(100, self.scroll_to_end, conversation_textview)
|
||||
gobject.timeout_add(50, self.scroll_to_end, conversation_textview)
|
||||
if ((jid != self.get_active_jid()) or (not self.window.is_active()) or \
|
||||
(not end)) and kind == 'incoming':
|
||||
self.nb_unread[jid] += 1
|
||||
|
|
|
@ -31,7 +31,7 @@ import version
|
|||
|
||||
GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade'
|
||||
|
||||
class vcard_information_window:
|
||||
class Vcard_information_window:
|
||||
"""Class for user's information window"""
|
||||
def on_user_information_window_destroy(self, widget=None):
|
||||
"""close window"""
|
||||
|
|
|
@ -375,8 +375,10 @@ class Groupchat_window(Chat):
|
|||
"""Call vcard_information_window class to display user's information"""
|
||||
if not self.plugin.windows[self.account]['infos'].has_key(jid):
|
||||
self.plugin.windows[self.account]['infos'][jid] = \
|
||||
vcard_information_window(jid, self.plugin, self.account, True)
|
||||
Vcard_information_window(jid, self.plugin, self.account, True)
|
||||
self.plugin.send('ASK_VCARD', self.account, jid)
|
||||
#FIXME: maybe use roster.on_info above?
|
||||
|
||||
#FIXME: we need the resource but it's not saved
|
||||
#self.plugin.send('ASK_OS_INFO', self.account, jid, resource)
|
||||
|
||||
|
|
|
@ -283,8 +283,6 @@ class plugin:
|
|||
def play_sound(self, event):
|
||||
if not self.config['sounds_on']:
|
||||
return
|
||||
if not self.config[event]: # FIXME: CAN THIS EVER HAPPEN?
|
||||
return
|
||||
path_to_soundfile = self.config[event + '_file']
|
||||
if not os.path.exists(path_to_soundfile):
|
||||
return
|
||||
|
@ -452,6 +450,9 @@ class plugin:
|
|||
not self.queues[account].has_key(jid):
|
||||
first = True
|
||||
if not self.config['autopopup']:
|
||||
#FIXME: check if the new msg was from contact in the roster or not
|
||||
# and display the name or the jid [if not]
|
||||
#if
|
||||
instance = Popup_window(self, 'New Message', 'From '+ jid )
|
||||
self.roster.popup_windows.append(instance)
|
||||
self.roster.on_message(jid, array[1], array[2], account)
|
||||
|
|
|
@ -392,9 +392,11 @@ class Roster_window:
|
|||
|
||||
def on_info(self, widget, user, account):
|
||||
"""Call vcard_information_window class to display user's information"""
|
||||
if not self.plugin.windows[account]['infos'].has_key(user.jid):
|
||||
if self.plugin.windows[account]['infos'].has_key(user.jid):
|
||||
self.plugin.windows[account]['infos'][user.jid].window.present()
|
||||
else:
|
||||
self.plugin.windows[account]['infos'][user.jid] = \
|
||||
vcard_information_window(user, self.plugin, account)
|
||||
Vcard_information_window(user, self.plugin, account)
|
||||
|
||||
def on_agent_logging(self, widget, jid, state, account):
|
||||
"""When an agent is requested to log in or off"""
|
||||
|
@ -920,9 +922,8 @@ class Roster_window:
|
|||
New_message_dialog(self.plugin, account)
|
||||
|
||||
def on_about_menuitem_activate(self, widget):
|
||||
About_dialog()
|
||||
#inst = Popup_window(self.plugin, 'Fake Message', 'nkour@')
|
||||
#self.popup_windows.append( inst )
|
||||
print self.get_contacts_list()
|
||||
#About_dialog()
|
||||
|
||||
def on_accounts_menuitem_activate(self, widget):
|
||||
if self.plugin.windows.has_key('accounts'):
|
||||
|
@ -1164,6 +1165,65 @@ class Roster_window:
|
|||
self.plugin.send('CONFIG', None, ('GtkGui', self.plugin.config, 'GtkGui'))
|
||||
self.draw_roster()
|
||||
|
||||
def get_groups_list(self):
|
||||
model = self.tree.get_model()
|
||||
list = []
|
||||
fin = False
|
||||
role = model.get_iter_root()
|
||||
if not role:
|
||||
return list
|
||||
while not fin:
|
||||
fin2 = False
|
||||
user = model.iter_children(role)
|
||||
if not user:
|
||||
fin2 = True
|
||||
while not fin2:
|
||||
group_name = model.get_value(user, 1)
|
||||
list.append(group_name)
|
||||
user = model.iter_next(user)
|
||||
if not user:
|
||||
fin2 = True
|
||||
role = model.iter_next(role)
|
||||
if not role:
|
||||
fin = True
|
||||
return list
|
||||
|
||||
def get_contacts_list(self):
|
||||
'''
|
||||
groups = self.get_groups_list()
|
||||
for g in groups:
|
||||
bla bla
|
||||
'''
|
||||
#OR TEST WITH CHAT --> ABOUT [freeze atm]
|
||||
'''
|
||||
model = self.tree.get_model()
|
||||
list = []
|
||||
fin = False
|
||||
role = model.get_iter_root()
|
||||
if not role:
|
||||
return list
|
||||
while not fin:
|
||||
fin2 = False
|
||||
group = model.iter_children(role)
|
||||
if not group:
|
||||
fin2 = True
|
||||
while not fin2:
|
||||
fin3 = False
|
||||
user = model.iter_children(group)
|
||||
if not user:
|
||||
fin3 = True
|
||||
while not fin3:
|
||||
contact_nick = model.get_value(user, 1)
|
||||
list.append(contact_nick)
|
||||
user = model.iter_next(user)
|
||||
if not user:
|
||||
fin3 = True
|
||||
role = model.iter_next(role)
|
||||
if not role:
|
||||
fin = True
|
||||
'''
|
||||
return list
|
||||
|
||||
def iconCellDataFunc(self, column, renderer, model, iter, data=None):
|
||||
"""When a row is added, set properties for icon renderer"""
|
||||
if model.get_value(iter, 2) == 'account':
|
||||
|
|
Loading…
Reference in New Issue