[client_icons] Refactor Plugin
- Use IconTheme - Add/Remove some clients
@@ -1,168 +1,178 @@
|
||||
CLIENTS = {
|
||||
'http://www.adium.im/': ['adium.png', 'Adium'],
|
||||
'http://www.adiumx.com/caps': ['adium.png', 'Adium'],
|
||||
'http://www.adiumx.com': ['adium.png', 'Adium'],
|
||||
'http://aqq.eu/': ['aqq.png', 'Aqq'],
|
||||
'http://www.asterisk.org/xmpp/client/caps': ['asterisk.png', 'Asterisk'],
|
||||
'http://ayttm.souceforge.net/caps': ['ayttm.png', 'Ayttm'],
|
||||
'http://www.barobin.com/caps': ['bayanicq.png', 'Bayanicq'],
|
||||
'http://bitlbee.org/xmpp/caps': ['bitlbee.png', 'BitlBee'],
|
||||
'http://simpleapps.ru/caps#blacksmith': ['bot.png', 'Blacksmith'],
|
||||
'http://blacksmith-2.googlecode.com/svn/': ['bot.png', 'Blacksmith-2'],
|
||||
'http://jabber.pdg.pl/caps': ['bombus-klub.png', 'Bombus-klub'],
|
||||
'http://klub54.wen.ru': ['bombus-klub.png', 'Bombus-klub'],
|
||||
'http://bombus-im.org/java': ['bombus.png', 'Bombus'],
|
||||
'http://bombusmod.net.ru/caps': ['bombusmod.png', 'Bombusmod'],
|
||||
'http://bombusng-md.googlecode.com': ['bombusng.png', 'Bombus-NG'],
|
||||
'http://bombus-im.org/ng': ['bombusng.png', 'Bombus-NG'],
|
||||
'http://voffk.org.ru/bombus': ['bombusplus.png', 'Bombus+'],
|
||||
'http://bombusng-qd.googlecode.com': ['bombusqd.png', 'Bombus-NG'],
|
||||
'http://bombusmod-qd.wen.ru/caps': ['bombusqd.png', 'BombusQD'],
|
||||
'http://bombusmod.net.ru': ['bombusmod.png', 'Bombusmod'],
|
||||
'http://ex-im.name/caps': ['bombusmod.png', 'Bombusmod'],
|
||||
'http://bombusmod.eu,http://bombus.pl': ['bombuspl.png', 'Bombusmod'],
|
||||
'ChatSecure': ['chatsecure.png', 'ChatSecure'],
|
||||
'http://coccinella.sourceforge.net/protocol/caps': \
|
||||
['coccinella.png', 'Coccinella'],
|
||||
'http://conversations.im': ['conversations.png', 'Conversations'],
|
||||
'Conversations Legacy': ['conversations-legacy.png', 'Conversations Legacy'],
|
||||
'https://conversejs.org': ['conversejs.png', 'Converse'],
|
||||
'http://digsby.com/caps': ['digsby.png', 'Digsby'],
|
||||
'https://dino.im': ['dino.png', 'Dino'],
|
||||
'http://emacs-jabber.sourceforge.net': ['emacs.png', 'Emacs Jabber client'],
|
||||
'http://emess.eqx.su/caps': ['emess.png', 'Emess'],
|
||||
'http://live.gnome.org/empathy/caps': \
|
||||
['telepathy.freedesktop.org.png', 'Empathy'],
|
||||
'http://eqo.com/': ['libpurple.png', 'Eqo'],
|
||||
'http://exodus.jabberstudio.org/caps': ['exodus.png', 'Exodus'],
|
||||
'http://fatal-bot.spb.ru/caps': ['bot.png', 'Fatal-bot'],
|
||||
'http://svn.posix.ru/fatal-bot/trunk': ['bot.png', 'Fatal-bot'],
|
||||
'http://isida.googlecode.com': ['isida-bot.png', 'Isida'],
|
||||
'http://isida-bot.com': ['isida-bot.png', 'Isida'],
|
||||
'facebook.com': ['facebook.png', 'Facebook'],
|
||||
'http://jabga.ru': ['fin.png', 'Fin jabber'],
|
||||
'http://chat.freize.org/caps': ['freize.png', 'Freize'],
|
||||
'http://gabber.sourceforge.net': ['gabber.png', 'Gabber'],
|
||||
'http://gaim.sf.net/caps': ['gaim.png', 'Gaim'],
|
||||
'http://gajim.org': ['gajim.png', 'Gajim'],
|
||||
'http://gajim.org/caps': ['gajim.png', 'Gajim'],
|
||||
'http://glu.net/': ['glu.png', 'Glu'],
|
||||
'http://mail.google.com/xmpp/client/caps': ['google.com.png', 'GMail'],
|
||||
'http://www.android.com/gtalk/client/caps': \
|
||||
['talk.google.com.png', 'GTalk'],
|
||||
'talk.google.com': ['talk.google.com.png', 'GTalk'],
|
||||
'http://talkgadget.google.com/client/caps': ['google.png', 'GTalk'],
|
||||
'http://talk.google.com/xmpp/bot/caps': ['google.png', 'GTalk'],
|
||||
'http://aspro.users.ru/historian-bot/': ['bot.png', 'Historian-bot'],
|
||||
'http://www.apple.com/ichat/caps': ['ichat.png', 'IChat'],
|
||||
'http://instantbird.com/': ['instantbird.png', 'Instantbird'],
|
||||
'http://j-tmb.ru/caps': ['bot.png', 'J-tmb'],
|
||||
'http://jabbroid.akuz.de': ['android.png', 'Jabbroid'],
|
||||
'http://jabbroid.akuz.de/caps': ['android.png', 'Jabbroid'],
|
||||
'http://dev.jabbim.cz/jabbim/caps': ['jabbim.png', 'Jabbim'],
|
||||
'http://jabbrik.ru/caps': ['bot.png', 'Jabbrik'],
|
||||
'http://jabrvista.net.ru': ['bot.png', 'Jabvista'],
|
||||
'http://jajc.jrudevels.org/caps': ['jajc.png', 'JAJC'],
|
||||
'http://qabber.ru/jame-bot': ['bot.png', 'Jame-bot'],
|
||||
'https://www.jappix.com/': ['jappix.png', 'Jappix'],
|
||||
'http://japyt.googlecode.com': ['japyt.png', 'Japyt'],
|
||||
'http://jasmineicq.ru/caps': ['jasmine.png', 'Jasmine'],
|
||||
'http://jimm.net.ru/caps': ['jimm-aspro.png', 'Jimm'],
|
||||
'http://jitsi.org' :['jitsi.png', 'Jitsi'],
|
||||
'http://jtalk.ustyugov.net/caps': ['jtalk.png', 'Jtalk'],
|
||||
'http://pjc.googlecode.com/caps': ['jubo.png', 'Jubo'],
|
||||
'http://juick.com/caps': ['juick.png', 'Juick'],
|
||||
'http://kopete.kde.org/jabber/caps': ['kopete.png', 'Kopete'],
|
||||
'http://bluendo.com/protocol/caps': ['lampiro.png', 'Lampiro'],
|
||||
'libpurple': ['libpurple.png', 'Libpurple'],
|
||||
'http://lytgeygen.ru/caps': ['bot.png', 'Lytgeygen'],
|
||||
'http://agent.mail.ru/caps': ['mailruagent.png', 'Mailruagent'],
|
||||
'http://agent.mail.ru/': ['mailruagent.png', 'Mailruagent'],
|
||||
'http://tomclaw.com/mandarin_im/caps': ['mandarin.png', 'Mandarin'],
|
||||
'http://mcabber.lilotux.net/caps': ['mcabber.png', 'MCabber'],
|
||||
'http://mcabber.com/caps': ['mcabber.png', 'MCabber'],
|
||||
'http://mchat.mgslab.com/': ['mchat.png', 'Mchat'],
|
||||
'https://www.meebo.com/': ['meebo.png', 'Meebo'],
|
||||
'http://megafonvolga.ru/': ['megafon.png', 'Megafon'],
|
||||
'http://miranda-im.org/caps': ['miranda.png', 'Miranda'],
|
||||
'http://miranda-ng.org/caps' :['miranda_ng.png', 'Miranda NG'],
|
||||
'http://moxl.movim.eu/': ['movim.png', 'Movim'],
|
||||
'nimbuzz:caps': ['nimbuzz.png', 'Nimbuzz'],
|
||||
'http://nimbuzz.com/caps': ['nimbuzz.png', 'Nimbuzz'],
|
||||
'http://home.gna.org/': ['omnipresence.png', 'Omnipresence'],
|
||||
'http://oneteam.im/caps': ['oneteamiphone.png', 'OneTeam'],
|
||||
'http://www.process-one.net/en/solutions/oneteam_iphone/': \
|
||||
['oneteamiphone.png', 'OneTeam-iphone'],
|
||||
'rss@isida-bot.com': ['osiris.png', 'Osiris'],
|
||||
'http://chat.ovi.com/caps': ['ovi-chat.png', 'Ovi-chat'],
|
||||
'http://opensource.palm.com/packages.html': ['palm.png', 'Palm'],
|
||||
'http://palringo.com/caps': ['palringo.png', 'Palringo'],
|
||||
'http://pandion.im/': ['pandion.png', 'Pandion'],
|
||||
'http://pidgin.im/': ['pidgin.png', 'Pidgin'],
|
||||
'http://pidgin.im/caps': ['pidgin.png', 'Pidgin'],
|
||||
'http://pigeon.vpro.ru/caps': ['pigeon.png', 'Pigeon'],
|
||||
'Pix-Art Messenger': ['pixart.png', 'Pix-Art Messenger'],
|
||||
'http://jabber.pix-art.de': ['pixart.png', 'Pix-Art Messenger'],
|
||||
'httр://sleekxmpp.com/ver/1.1.11': ['poezio.png', 'Poezio'],
|
||||
'https://poez.io': ['poezio.png', 'Poezio'],
|
||||
'http://www.profanity.im': ['profanity.png', 'Profanity'],
|
||||
'http://psi-im.org/caps': ['psi.png', 'Psi'],
|
||||
'http://psi-plus.com': ['psiplus.png', 'Psi+'],
|
||||
'http://psi-dev.googlecode.com/caps': ['psiplus.png', 'Psi+'],
|
||||
'psto@psto.net': ['psto.png', 'Psto'],
|
||||
'http://pyaim': ['pyaim-t.png', 'PyAIM-t'],
|
||||
'http://pyicq': ['pyicq-t.png', 'PyICQ-t'],
|
||||
'http://spectrum.im/transport': ['pyicq-t.png', 'PyICQ-t'],
|
||||
'http://qq-im.com/caps': ['qq.png', 'QQ'],
|
||||
'http://qq.com/caps': ['qq.png', 'QQ'],
|
||||
'http://2010.qip.ru/caps': ['qip.png', 'Qip'],
|
||||
'http://qip.ru/caps': ['qip.png', 'Qip'],
|
||||
'http://qip.ru/caps?QIP': ['qip.png', 'Qip'],
|
||||
'http://pda.qip.ru/caps': ['qippda.png', 'Qip-PDA'],
|
||||
'http://qutim.org': ['qutim.png', 'QutIM'],
|
||||
'http://qutim.org/': ['qutim.png', 'QutIM'],
|
||||
'http://apps.radio-t.com/caps': ['radio-t.png', 'Radio-t'],
|
||||
'Siemens': ['siejc.png', 'Siemens'], # Siemens Native Jabber Client
|
||||
'http://sim-im.org/caps': ['sim.png', 'Sim'],
|
||||
'http://www.lonelycatgames.com/slick/caps': ['slick.png', 'Slick'],
|
||||
'http://slixmpp.com/ver/1.2.4': ['bot.png', 'Slixmpp'],
|
||||
'http://slixmpp.com/ver/1.3.0': ['bot.png', 'Slixmpp'],
|
||||
'http://snapi-bot.googlecode.com/caps': ['bot.png', 'Snapi-bot'],
|
||||
'http://www.igniterealtime.org/project/spark/caps': ['spark.png', 'Spark'],
|
||||
'http://spectrum.im/': ['spectrum.png', 'Spectrum'],
|
||||
'http://storm-bot.googlecode.com/svn/trunk': ['bot.png', 'Storm-bot'],
|
||||
'http://swift.im': ['swift.png', 'Swift'],
|
||||
'http://jabber-net.ru/caps/talisman-bot': ['bot.png', 'Talisman-bot'],
|
||||
'http://jabber-net.ru/talisman-bot/caps': ['bot.png', 'Talisman-bot'],
|
||||
'http://www.google.com/xmpp/client/caps': ['talkonaut.png', 'Talkonaut'],
|
||||
'telepathy.': ['telepathy.freedesktop.org.png', 'Telepathy'],
|
||||
'http://telepathy.freedesktop.org/caps': \
|
||||
['telepathy.freedesktop.org.png', 'Telepathy'],
|
||||
'http://tigase.org/messenger': ['tigase.png', 'Tigase'],
|
||||
'http://tkabber.jabber.ru/': ['tkabber.png', 'Tkabber'],
|
||||
'http://trillian.im/caps': ['trillian.png', 'Trillian'],
|
||||
'http://vacuum-im.googlecode.com': ['vacuum.png', 'Vacuum'],
|
||||
'http://code.google.com/p/vacuum-im/': ['vacuum.png', 'Vacuum'],
|
||||
'vk.com': ['vkontakte.png', 'Vkontakte'],
|
||||
'http://pyvk-t.googlecode.com/caps': ['vkontakte.png', 'Vkontakte'],
|
||||
'http://pyvk': ['vkontakte.png', 'Vkontakte'],
|
||||
'http://witcher-team.ucoz.ru/': ['bot.png', 'Witcher'],
|
||||
'http://online.yandex.ru/caps': ['yaonline.png', 'Yaonline'],
|
||||
'http://www.igniterealtime.org/projects/smack/': ['xabber.png', 'Xabber'],
|
||||
'https://www.xabber.com/': ['xabber.png', 'Xabber'],
|
||||
'http://www.xfire.com/': ['xfire.png', 'Xfire'],
|
||||
'http://www.xfire.com/caps': ['xfire.png', 'Xfire'],
|
||||
'https://www.yaxim.org/': ['yaxim.png', 'Yaxim'],
|
||||
'http://xu-6.jabbrik.ru/caps': ['bot.png', 'XU-6'],
|
||||
}
|
||||
LIBPURPLE_CLIENTS = {
|
||||
'adium': 'http://www.adium.im/',
|
||||
'eqo': 'http://eqo.com/',
|
||||
'finch': 'http://pidgin.im/',
|
||||
'instantbird': 'http://instantbird.com/',
|
||||
'meebo': 'https://www.meebo.com/',
|
||||
'palm': 'http://opensource.palm.com/packages.html',
|
||||
'pidgin': 'http://pidgin.im/',
|
||||
'spectrum': 'http://spectrum.im/',
|
||||
'telepathy-haze': 'http://pidgin.im/'
|
||||
}
|
||||
from collections import UserDict
|
||||
from collections import namedtuple
|
||||
|
||||
from gajim.plugins.plugins_i18n import _
|
||||
|
||||
ClientData = namedtuple('ClientData', ['default', 'variations'])
|
||||
ClientData.__new__.__defaults__ = (None,)
|
||||
|
||||
|
||||
def get_variations(client_name):
|
||||
# get_variations('Conversation Legacy 1.2.3')
|
||||
#
|
||||
# Returns List:
|
||||
# [Conversation Legacy 1.2.3,
|
||||
# Conversation Legacy
|
||||
# Conversation]
|
||||
if client_name is None:
|
||||
return []
|
||||
alts = client_name.split()
|
||||
alts = [" ".join(alts[:(i + 1)]) for i in range(len(alts))]
|
||||
alts.reverse()
|
||||
return alts
|
||||
|
||||
|
||||
class ClientsDict(UserDict):
|
||||
def get_client_data(self, name, node):
|
||||
client_data = self.get(node)
|
||||
if client_data is None:
|
||||
return _('Unknown'), 'xmpp-client-unknown'
|
||||
|
||||
if client_data.variations is None:
|
||||
client_name, icon_name = client_data.default
|
||||
return client_name, 'xmpp-client-%s' % icon_name
|
||||
|
||||
variations = get_variations(name)
|
||||
for var in variations:
|
||||
try:
|
||||
return var, 'xmpp-client-%s' % client_data.variations[var]
|
||||
except KeyError:
|
||||
pass
|
||||
client_name, icon_name = client_data.default
|
||||
return client_name, 'xmpp-client-%s' % icon_name
|
||||
|
||||
|
||||
# ClientData(
|
||||
# default=(Shown name, icon name)
|
||||
# variations={Shown name, icon name}
|
||||
# )
|
||||
|
||||
CLIENTS = ClientsDict({
|
||||
'http://gajim.org': ClientData(('Gajim', 'gajim')),
|
||||
'http://conversations.im': ClientData(
|
||||
default=('Conversations', 'conversations'),
|
||||
variations={'Conversations Legacy': 'conversations-legacy'}
|
||||
),
|
||||
'http://pidgin.im/': ClientData(('Pidgin', 'pidgin')),
|
||||
'https://poez.io': ClientData(('Poezio', 'poezio')),
|
||||
'https://yaxim.org/': ClientData(('yaxim', 'yaxim')),
|
||||
'https://yaxim.org/bruno/': ClientData(('Bruno', 'bruno')),
|
||||
'http://jabber.pix-art.de': ClientData(('Pix-Art Messenger', 'pixart')),
|
||||
'http://mcabber.com/caps': ClientData(('MCabber', 'mcabber')),
|
||||
'http://psi-plus.com': ClientData(('Psi+', 'psiplus')),
|
||||
'https://dino.im': ClientData(('Dino', 'dino')),
|
||||
'http://slixmpp.com/ver/1.2.4': ClientData(('Bot', 'bot')),
|
||||
'http://slixmpp.com/ver/1.3.0': ClientData(('Bot', 'bot')),
|
||||
'https://www.xabber.com/': ClientData(('Xabber', 'xabber')),
|
||||
'http://www.profanity.im': ClientData(('Profanity', 'profanity')),
|
||||
'http://swift.im': ClientData(('Swift', 'swift')),
|
||||
'https://salut-a-toi.org': ClientData(('Salut à Toi', 'sat')),
|
||||
'https://conversejs.org': ClientData(('Converse', 'conversejs')),
|
||||
'http://bitlbee.org/xmpp/caps': ClientData(('BitlBee', 'bitlbee')),
|
||||
'http://tkabber.jabber.ru/': ClientData(('Tkabber', 'tkabber')),
|
||||
'http://miranda-ng.org/caps': ClientData(('Miranda NG', 'miranda_ng')),
|
||||
'http://www.adium.im/': ClientData(('Adium', 'adium')),
|
||||
'http://www.adiumx.com/caps': ClientData(('Adium', 'adium')),
|
||||
'http://www.adiumx.com': ClientData(('Adium', 'adium')),
|
||||
'http://aqq.eu/': ClientData(('Aqq', 'aqq')),
|
||||
'http://www.asterisk.org/xmpp/client/caps': ClientData(('Asterisk', 'asterisk')),
|
||||
'http://ayttm.souceforge.net/caps': ClientData(('Ayttm', 'ayttm')),
|
||||
'http://www.barobin.com/caps': ClientData(('Bayanicq', 'bayanicq')),
|
||||
'http://simpleapps.ru/caps#blacksmith': ClientData(('Blacksmith', 'bot')),
|
||||
'http://blacksmith-2.googlecode.com/svn/': ClientData(('Blacksmith-2', 'bot')),
|
||||
'http://coccinella.sourceforge.net/protocol/caps': ClientData(('Coccinella', 'coccinella')),
|
||||
'http://digsby.com/caps': ClientData(('Digsby', 'digsby')),
|
||||
'http://emacs-jabber.sourceforge.net': ClientData(('Emacs Jabber Client', 'emacs')),
|
||||
'http://emess.eqx.su/caps': ClientData(('Emess', 'emess')),
|
||||
'http://live.gnome.org/empathy/caps': ClientData(('Empathy', 'telepathy.freedesktop.org')),
|
||||
'http://eqo.com/': ClientData(('Eqo', 'libpurple')),
|
||||
'http://exodus.jabberstudio.org/caps': ClientData(('Exodus', 'exodus')),
|
||||
'http://fatal-bot.spb.ru/caps': ClientData(('Fatal-bot', 'bot')),
|
||||
'http://svn.posix.ru/fatal-bot/trunk': ClientData(('Fatal-bot', 'bot')),
|
||||
'http://isida.googlecode.com': ClientData(('Isida', 'isida-bot')),
|
||||
'http://isida-bot.com': ClientData(('Isida', 'isida-bot')),
|
||||
'http://jabga.ru': ClientData(('Fin jabber', 'fin')),
|
||||
'http://chat.freize.org/caps': ClientData(('Freize', 'freize')),
|
||||
'http://gabber.sourceforge.net': ClientData(('Gabber', 'gabber')),
|
||||
'http://glu.net/': ClientData(('Glu', 'glu')),
|
||||
'http://mail.google.com/xmpp/client/caps': ClientData(('GMail', 'google.com')),
|
||||
'http://www.android.com/gtalk/client/caps': ClientData(('GTalk', 'talk.google.com')),
|
||||
'talk.google.com': ClientData(('GTalk', 'talk.google.com')),
|
||||
'http://talkgadget.google.com/client/caps': ClientData(('GTalk', 'google')),
|
||||
'http://talk.google.com/xmpp/bot/caps': ClientData(('GTalk', 'google')),
|
||||
'http://aspro.users.ru/historian-bot/': ClientData(('Historian-bot', 'bot')),
|
||||
'http://www.apple.com/ichat/caps': ClientData(('IChat', 'ichat')),
|
||||
'http://instantbird.com/': ClientData(('Instantbird', 'instantbird')),
|
||||
'http://j-tmb.ru/caps': ClientData(('J-tmb', 'bot')),
|
||||
'http://jabbroid.akuz.de': ClientData(('Jabbroid', 'android')),
|
||||
'http://jabbroid.akuz.de/caps': ClientData(('Jabbroid', 'android')),
|
||||
'http://dev.jabbim.cz/jabbim/caps': ClientData(('Jabbim', 'jabbim')),
|
||||
'http://jabbrik.ru/caps': ClientData(('Jabbrik', 'bot')),
|
||||
'http://jabrvista.net.ru': ClientData(('Jabvista', 'bot')),
|
||||
'http://jajc.jrudevels.org/caps': ClientData(('JAJC', 'jajc')),
|
||||
'http://qabber.ru/jame-bot': ClientData(('Jame-bot', 'bot')),
|
||||
'https://www.jappix.com/': ClientData(('Jappix', 'jappix')),
|
||||
'http://japyt.googlecode.com': ClientData(('Japyt', 'japyt')),
|
||||
'http://jasmineicq.ru/caps': ClientData(('Jasmine', 'jasmine')),
|
||||
'http://jimm.net.ru/caps': ClientData(('Jimm', 'jimm-aspro')),
|
||||
'http://jitsi.org': ClientData(('Jitsi', 'jitsi')),
|
||||
'http://jtalk.ustyugov.net/caps': ClientData(('Jtalk', 'jtalk')),
|
||||
'http://pjc.googlecode.com/caps': ClientData(('Jubo', 'jubo')),
|
||||
'http://juick.com/caps': ClientData(('Juick', 'juick')),
|
||||
'http://kopete.kde.org/jabber/caps': ClientData(('Kopete', 'kopete')),
|
||||
'http://bluendo.com/protocol/caps': ClientData(('Lampiro', 'lampiro')),
|
||||
'http://lytgeygen.ru/caps': ClientData(('Lytgeygen', 'bot')),
|
||||
'http://agent.mail.ru/caps': ClientData(('Mailruagent', 'mailruagent')),
|
||||
'http://agent.mail.ru/': ClientData(('Mailruagent', 'mailruagent')),
|
||||
'http://tomclaw.com/mandarin_im/caps': ClientData(('Mandarin', 'mandarin')),
|
||||
'http://mchat.mgslab.com/': ClientData(('Mchat', 'mchat')),
|
||||
'https://www.meebo.com/': ClientData(('Meebo', 'meebo')),
|
||||
'http://megafonvolga.ru/': ClientData(('Megafon', 'megafon')),
|
||||
'http://miranda-im.org/caps': ClientData(('Miranda', 'miranda')),
|
||||
'http://moxl.movim.eu/': ClientData(('Movim', 'movim')),
|
||||
'nimbuzz:caps': ClientData(('Nimbuzz', 'nimbuzz')),
|
||||
'http://nimbuzz.com/caps': ClientData(('Nimbuzz', 'nimbuzz')),
|
||||
'http://home.gna.org/': ClientData(('Omnipresence', 'omnipresence')),
|
||||
'http://oneteam.im/caps': ClientData(('OneTeam', 'oneteamiphone')),
|
||||
'http://www.process-one.net/en/solutions/oneteam_iphone/': ClientData(('OneTeam-IPhone', 'oneteamiphone')),
|
||||
'rss@isida-bot.com': ClientData(('Osiris', 'osiris')),
|
||||
'http://chat.ovi.com/caps': ClientData(('Ovi-chat', 'ovi-chat')),
|
||||
'http://opensource.palm.com/packages.html': ClientData(('Palm', 'palm')),
|
||||
'http://palringo.com/caps': ClientData(('Palringo', 'palringo')),
|
||||
'http://pandion.im/': ClientData(('Pandion', 'pandion')),
|
||||
'http://pigeon.vpro.ru/caps': ClientData(('Pigeon', 'pigeon')),
|
||||
'psto@psto.net': ClientData(('Psto', 'psto')),
|
||||
'http://qq-im.com/caps': ClientData(('QQ', 'qq')),
|
||||
'http://qq.com/caps': ClientData(('QQ', 'qq')),
|
||||
'http://2010.qip.ru/caps': ClientData(('Qip', 'qip')),
|
||||
'http://qip.ru/caps': ClientData(('Qip', 'qip')),
|
||||
'http://qip.ru/caps?QIP': ClientData(('Qip', 'qip')),
|
||||
'http://pda.qip.ru/caps': ClientData(('Qip-PDA', 'qippda')),
|
||||
'http://qutim.org': ClientData(('QutIM', 'qutim')),
|
||||
'http://qutim.org/': ClientData(('QutIM', 'qutim')),
|
||||
'http://apps.radio-t.com/caps': ClientData(('Radio-t', 'radio-t')),
|
||||
'http://sim-im.org/caps': ClientData(('Sim', 'sim')),
|
||||
'http://www.lonelycatgames.com/slick/caps': ClientData(('Slick', 'slick')),
|
||||
'http://snapi-bot.googlecode.com/caps': ClientData(('Snapi-bot', 'bot')),
|
||||
'http://www.igniterealtime.org/project/spark/caps': ClientData(('Spark', 'spark')),
|
||||
'http://spectrum.im/': ClientData(('Spectrum', 'spectrum')),
|
||||
'http://storm-bot.googlecode.com/svn/trunk': ClientData(('Storm-bot', 'bot')),
|
||||
'http://jabber-net.ru/caps/talisman-bot': ClientData(('Talisman-bot', 'bot')),
|
||||
'http://jabber-net.ru/talisman-bot/caps': ClientData(('Talisman-bot', 'bot')),
|
||||
'http://www.google.com/xmpp/client/caps': ClientData(('Talkonaut', 'talkonaut')),
|
||||
'http://telepathy.freedesktop.org/caps': ClientData(('SlicTelepathyk', 'telepathy.freedesktop.org')),
|
||||
'http://tigase.org/messenger': ClientData(('Tigase', 'tigase')),
|
||||
'http://trillian.im/caps': ClientData(('Trillian', 'trillian')),
|
||||
'http://vacuum-im.googlecode.com': ClientData(('Vacuum', 'vacuum')),
|
||||
'http://code.google.com/p/vacuum-im/': ClientData(('Vacuum', 'vacuum')),
|
||||
'http://witcher-team.ucoz.ru/': ClientData(('Witcher', 'bot')),
|
||||
'http://online.yandex.ru/caps': ClientData(('Yaonline', 'yaonline')),
|
||||
'http://www.igniterealtime.org/projects/smack/': ClientData(('Xabber', 'xabber')),
|
||||
'http://www.xfire.com/': ClientData(('Xfire', 'xfire')),
|
||||
'http://www.xfire.com/caps': ClientData(('Xfire', 'xfire')),
|
||||
'http://xu-6.jabbrik.ru/caps': ClientData(('XU-6', 'bot')),
|
||||
})
|
||||
|
||||
|
||||
def get_data(*args):
|
||||
return CLIENTS.get_client_data(*args)
|
||||
|
||||
@@ -1,41 +1,36 @@
|
||||
import os
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import GdkPixbuf
|
||||
from nbxmpp import JID
|
||||
|
||||
from clients_icons.clients import CLIENTS, LIBPURPLE_CLIENTS
|
||||
from clients_icons import clients
|
||||
|
||||
from gajim.roster_window import Column
|
||||
|
||||
from gajim.plugins.gui import GajimPluginConfigDialog
|
||||
from gajim.plugins import GajimPlugin
|
||||
from gajim.plugins.helpers import log_calls
|
||||
from gajim.plugins.gui import GajimPluginConfigDialog
|
||||
from gajim.plugins.plugins_i18n import _
|
||||
|
||||
from gajim.common import ged
|
||||
from gajim.common import app
|
||||
from gajim.common import caps_cache
|
||||
|
||||
# Since Gajim 1.1.0 _() has to be imported
|
||||
try:
|
||||
from gajim.common.i18n import _
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
log = logging.getLogger('gajim.plugin_system.clients_icons')
|
||||
from gajim.gtk.util import load_icon
|
||||
|
||||
|
||||
log = logging.getLogger('gajim.plugin_system.client_icons')
|
||||
|
||||
|
||||
class ClientsIconsPlugin(GajimPlugin):
|
||||
|
||||
@log_calls('ClientsIconsPlugin')
|
||||
def init(self):
|
||||
self.description = _('Shows client icons in roster'
|
||||
' and in groupchats.')
|
||||
self.pos_list = [_('after statusicon'), _('before avatar')]
|
||||
self.events_handlers = {
|
||||
'caps-presence-received': (ged.POSTGUI,
|
||||
self.caps_presence_received),
|
||||
'gc-presence-received': (ged.POSTGUI,
|
||||
self.gc_presence_received),
|
||||
'caps-disco-received': (ged.POSTGUI,
|
||||
self.caps_disco_received), }
|
||||
'caps-update': (ged.POSTGUI, self._on_caps_update),
|
||||
}
|
||||
self.gui_extension_points = {
|
||||
'groupchat_control': (self.connect_with_groupchat_control,
|
||||
self.disconnect_from_groupchat_control),
|
||||
@@ -49,37 +44,23 @@ class ClientsIconsPlugin(GajimPlugin):
|
||||
'show_in_tooltip': (True, ''),
|
||||
'show_unknown_icon': (True, ''),
|
||||
'pos_in_list': (0, ''),
|
||||
'show_facebook': (True, ''),}
|
||||
'show_facebook': (True, ''),
|
||||
}
|
||||
|
||||
_icon_theme = Gtk.IconTheme.get_default()
|
||||
if _icon_theme is not None:
|
||||
_icon_theme.append_search_path(str(Path(__file__).parent))
|
||||
|
||||
self.config_dialog = ClientsIconsPluginConfigDialog(self)
|
||||
icon_path = os.path.join(self.local_file_path('icons'), 'unknown.png')
|
||||
self.default_pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(
|
||||
icon_path, 16, 16)
|
||||
self.icon_cache = {}
|
||||
|
||||
@log_calls('ClientsIconsPlugin')
|
||||
def get_client_name(self, contact, client_name):
|
||||
@staticmethod
|
||||
def get_client_identity_name(contact):
|
||||
identities = contact.client_caps.get_cache_lookup_strategy()(
|
||||
caps_cache.capscache).identities
|
||||
if identities:
|
||||
log.debug('get_client_name, identities: %s', str(identities))
|
||||
for entry in identities:
|
||||
if entry['category'] == 'client':
|
||||
client_name = entry.get('name', client_name)
|
||||
break
|
||||
return client_name
|
||||
|
||||
def get_client_icon_by_name(self, client_name):
|
||||
client_icon = None
|
||||
name_splits = client_name.split()
|
||||
name_splits = reversed([" ".join(name_splits[:(i+1)]) for i in range(len(name_splits))])
|
||||
for name in name_splits:
|
||||
if not client_icon:
|
||||
log.debug("get_client_icon_by_name, searching for name fragment '%s'..." % name)
|
||||
client_icon = CLIENTS.get(name, (None,))[0]
|
||||
if client_icon:
|
||||
break
|
||||
return client_icon
|
||||
return entry.get('name')
|
||||
|
||||
@staticmethod
|
||||
def is_groupchat(contact):
|
||||
@@ -87,14 +68,10 @@ class ClientsIconsPlugin(GajimPlugin):
|
||||
return contact.is_groupchat()
|
||||
return False
|
||||
|
||||
@log_calls('ClientsIconsPlugin')
|
||||
def add_tooltip_row(self, tooltip, contact, tooltip_grid):
|
||||
caps = contact.client_caps._node
|
||||
log.debug('connect_with_gc_tooltip_populate, caps: %s', caps)
|
||||
caps_image, client_name = self.get_icon(caps, contact)
|
||||
client_name = self.get_client_name(contact, client_name)
|
||||
caps_image, client_name = self.get_icon(caps, contact, tooltip_grid)
|
||||
caps_image.set_halign(Gtk.PositionType.RIGHT)
|
||||
log.debug('connect_with_gc_tooltip_populate, client_name: %s', client_name)
|
||||
|
||||
# fill clients table
|
||||
self.table = Gtk.Grid()
|
||||
@@ -122,27 +99,25 @@ class ClientsIconsPlugin(GajimPlugin):
|
||||
tooltip_grid.attach_next_to(self.table, label,
|
||||
Gtk.PositionType.RIGHT, 1, 1)
|
||||
|
||||
@log_calls('ClientsIconsPlugin')
|
||||
def connect_with_gc_tooltip_populate(self, tooltip, contact, tooltip_grid):
|
||||
if not self.config['show_in_tooltip']:
|
||||
return
|
||||
# Check if clients info already attached to tooltip
|
||||
has_attached = False
|
||||
for child in tooltip_grid.get_children():
|
||||
if child.get_name() == 'client_icons_grid':
|
||||
caps = contact.client_caps._node
|
||||
caps_image, client_name = self.get_icon(caps, contact)
|
||||
child.remove(child.get_child_at(1, 1))
|
||||
child.attach(caps_image, 1, 1, 1, 1)
|
||||
child.get_child_at(2, 1).set_markup(client_name)
|
||||
child.show_all()
|
||||
if child.get_name() == 'client_icons_label':
|
||||
child.show()
|
||||
has_attached = True
|
||||
if not has_attached:
|
||||
self.add_tooltip_row(tooltip, contact, tooltip_grid)
|
||||
|
||||
@log_calls('ClientsIconsPlugin')
|
||||
node = contact.client_caps._node
|
||||
image, client_name = self.get_icon(node, contact, tooltip_grid)
|
||||
label = Gtk.Label(label=client_name)
|
||||
|
||||
box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
|
||||
box.add(image)
|
||||
box.add(label)
|
||||
box.show_all()
|
||||
|
||||
tooltip_grid.insert_next_to(tooltip._ui.affiliation,
|
||||
Gtk.PositionType.BOTTOM)
|
||||
tooltip_grid.attach_next_to(box, tooltip._ui.affiliation,
|
||||
Gtk.PositionType.BOTTOM, 1, 1)
|
||||
|
||||
def connect_with_roster_tooltip_populate(self, tooltip, contacts, tooltip_grid):
|
||||
if not self.config['show_in_tooltip']:
|
||||
return
|
||||
@@ -155,6 +130,8 @@ class ClientsIconsPlugin(GajimPlugin):
|
||||
num_resources = 0
|
||||
contacts_dict = {}
|
||||
for contact in contacts:
|
||||
if contact.show == 'offline':
|
||||
return
|
||||
if contact.resource:
|
||||
num_resources += 1
|
||||
if int(contact.priority) in contacts_dict:
|
||||
@@ -165,97 +142,50 @@ class ClientsIconsPlugin(GajimPlugin):
|
||||
contact_keys.reverse()
|
||||
|
||||
# fill clients table
|
||||
self.table = Gtk.Grid()
|
||||
self.table.insert_row(0)
|
||||
self.table.insert_row(0)
|
||||
self.table.insert_column(0)
|
||||
self.table.set_property('column-spacing', 2)
|
||||
table = Gtk.Grid()
|
||||
table.insert_row(0)
|
||||
table.insert_row(0)
|
||||
table.insert_column(0)
|
||||
table.set_property('column-spacing', 2)
|
||||
|
||||
vcard_current_row = 0
|
||||
for priority in contact_keys:
|
||||
for acontact in contacts_dict[priority]:
|
||||
caps = acontact.client_caps._node
|
||||
caps_image, client_name = self.get_icon(caps, acontact)
|
||||
client_name = self.get_client_name(acontact, client_name)
|
||||
caps_image.set_alignment(0, 0)
|
||||
self.table.attach(caps_image, 1, vcard_current_row, 1, 1)
|
||||
label = Gtk.Label()
|
||||
label.set_alignment(0, 0)
|
||||
label.set_markup(client_name)
|
||||
self.table.attach(label, 2, vcard_current_row, 1, 1)
|
||||
caps_image, client_name = self.get_icon(caps, acontact, tooltip_grid)
|
||||
caps_image.set_valign(Gtk.Align.START)
|
||||
table.attach(caps_image, 1, vcard_current_row, 1, 1)
|
||||
label = Gtk.Label(label=client_name)
|
||||
label.set_valign(Gtk.Align.START)
|
||||
label.set_xalign(0)
|
||||
table.attach(label, 2, vcard_current_row, 1, 1)
|
||||
vcard_current_row += 1
|
||||
self.table.show_all()
|
||||
table.show_all()
|
||||
table.set_valign(Gtk.Align.START)
|
||||
|
||||
# set label
|
||||
label = Gtk.Label()
|
||||
label.set_alignment(0, 0)
|
||||
label.set_halign(Gtk.Align.END)
|
||||
label.set_valign(Gtk.Align.START)
|
||||
if num_resources > 1:
|
||||
label.set_markup(_('Clients:'))
|
||||
label.set_text(_('Clients:'))
|
||||
else:
|
||||
if contact.show == 'offline':
|
||||
return
|
||||
label.set_markup(_('Client:'))
|
||||
label.set_text(_('Client:'))
|
||||
label.show()
|
||||
# set clients table to tooltip
|
||||
tooltip_grid.insert_next_to(tooltip.resource_label,
|
||||
tooltip_grid.insert_next_to(tooltip._ui.resource_label,
|
||||
Gtk.PositionType.BOTTOM)
|
||||
tooltip_grid.attach_next_to(label, tooltip.resource_label,
|
||||
tooltip_grid.attach_next_to(label, tooltip._ui.resource_label,
|
||||
Gtk.PositionType.BOTTOM, 1, 1)
|
||||
tooltip_grid.attach_next_to(self.table, label,
|
||||
tooltip_grid.attach_next_to(table, label,
|
||||
Gtk.PositionType.RIGHT, 1, 1)
|
||||
|
||||
def get_icon(self, caps, contact):
|
||||
client_name = _('Unknown')
|
||||
caps_ = None
|
||||
if caps:
|
||||
# libpurple returns pidgin.im/ only, we have to look for resource name
|
||||
if 'pidgin.im/' in caps:
|
||||
caps = 'libpurple'
|
||||
for client in LIBPURPLE_CLIENTS:
|
||||
if client in contact.resource.lower():
|
||||
caps = LIBPURPLE_CLIENTS[client]
|
||||
def get_icon(self, node, contact, widget):
|
||||
identity_name = self.get_client_identity_name(contact)
|
||||
client_name, icon_name = clients.get_data(identity_name, node)
|
||||
surface = load_icon(icon_name, widget=widget)
|
||||
return Gtk.Image.new_from_surface(surface), client_name
|
||||
|
||||
if 'sleekxmpp.com'in caps:
|
||||
caps = 'httр://sleekxmpp.com/ver/1.1.11'
|
||||
caps_from_jid = self.check_jid(contact.jid)
|
||||
if caps_from_jid:
|
||||
caps = caps_from_jid
|
||||
caps_ = caps.split('#')[0].split()
|
||||
|
||||
client_name = self.get_client_name(contact, client_name)
|
||||
client_icon = self.get_client_icon_by_name(client_name)
|
||||
|
||||
if caps_ and not client_icon:
|
||||
client_icon = CLIENTS.get(caps_[0].split()[0], (None,))[0]
|
||||
client_name = CLIENTS.get(caps_[0].split()[0], ('', _('Unknown')))[1]
|
||||
|
||||
if not client_icon:
|
||||
return Gtk.Image.new_from_pixbuf(self.default_pixbuf), _('Unknown')
|
||||
else:
|
||||
icon_path = os.path.join(self.local_file_path('icons'), client_icon)
|
||||
if icon_path in self.icon_cache:
|
||||
return Gtk.Image.new_from_pixbuf(self.icon_cache[icon_path]), \
|
||||
client_name
|
||||
else:
|
||||
pb = GdkPixbuf.Pixbuf.new_from_file_at_size(icon_path, 16, 16)
|
||||
self.icon_cache[icon_path] = pb
|
||||
return Gtk.Image.new_from_pixbuf(pb), client_name
|
||||
|
||||
def check_jid(self, jid):
|
||||
caps = None
|
||||
if 'facebook.com' in jid and self.config['show_facebook']:
|
||||
caps = 'facebook.com'
|
||||
elif '@vk.com' in jid and self.config['show_facebook']:
|
||||
caps = 'vk.com'
|
||||
elif jid == 'juick@juick.com':
|
||||
caps = 'http://juick.com/caps'
|
||||
elif jid == 'psto@psto.net':
|
||||
caps = 'psto@psto.net'
|
||||
elif jid == 'rss@isida-bot.com':
|
||||
caps = 'rss@isida-bot.com'
|
||||
return caps
|
||||
|
||||
@log_calls('ClientsIconsPlugin')
|
||||
def connect_with_roster_draw_contact(self, roster, jid, account, contact):
|
||||
if not self.active:
|
||||
return
|
||||
@@ -268,22 +198,19 @@ class ClientsIconsPlugin(GajimPlugin):
|
||||
return
|
||||
for iter_ in child_iters:
|
||||
if roster.model[iter_][self.renderer_num] is None:
|
||||
caps = contact.client_caps._node
|
||||
if not caps:
|
||||
caps = self.check_jid(jid)
|
||||
self.set_icon(roster.model, iter_, self.renderer_num, caps, contact)
|
||||
node = contact.client_caps._node
|
||||
self.set_icon(roster.model, iter_, self.renderer_num, node, contact)
|
||||
|
||||
@log_calls('ClientsIconsPlugin')
|
||||
def connect_with_groupchat_control(self, chat_control):
|
||||
chat_control.nb_ext_renderers += 1
|
||||
chat_control.columns += [GdkPixbuf.Pixbuf]
|
||||
chat_control.columns += [str]
|
||||
self.groupchats_tree_is_transformed = True
|
||||
self.chat_control = chat_control
|
||||
col = Gtk.TreeViewColumn()
|
||||
self.muc_renderer_num = 4 + chat_control.nb_ext_renderers
|
||||
client_icon_rend = (
|
||||
'client_icon', Gtk.CellRendererPixbuf(), False,
|
||||
'pixbuf', self.muc_renderer_num,
|
||||
'icon_name', self.muc_renderer_num,
|
||||
self.tree_cell_data_func, chat_control)
|
||||
# remove old column
|
||||
chat_control.list_treeview.remove_column(
|
||||
@@ -310,14 +237,10 @@ class ClientsIconsPlugin(GajimPlugin):
|
||||
chat_control.account, chat_control.room_jid):
|
||||
gc_contact = app.contacts.get_gc_contact(
|
||||
chat_control.account, chat_control.room_jid, nick)
|
||||
iter_ = chat_control.add_contact_to_roster(
|
||||
nick, gc_contact.show, gc_contact.role,
|
||||
gc_contact.affiliation, gc_contact.status, gc_contact.jid)
|
||||
iter_ = chat_control.add_contact_to_roster(nick)
|
||||
if not self.config['show_in_groupchats']:
|
||||
log.debug("not showing in groupchats...")
|
||||
continue
|
||||
caps = gc_contact.client_caps._node
|
||||
log.debug("caps: %s" % str(caps))
|
||||
self.set_icon(
|
||||
chat_control.model, iter_,
|
||||
self.muc_renderer_num, caps, gc_contact)
|
||||
@@ -325,7 +248,6 @@ class ClientsIconsPlugin(GajimPlugin):
|
||||
# Recalculate column width for ellipsizin
|
||||
chat_control.list_treeview.columns_autosize()
|
||||
|
||||
@log_calls('ClientsIconsPlugin')
|
||||
def disconnect_from_groupchat_control(self, gc_control):
|
||||
gc_control.nb_ext_renderers -= 1
|
||||
col = gc_control.list_treeview.get_column(0)
|
||||
@@ -345,7 +267,6 @@ class ClientsIconsPlugin(GajimPlugin):
|
||||
gc_control.list_treeview.set_model(gc_control.model)
|
||||
gc_control.draw_roster()
|
||||
|
||||
@log_calls('ClientsIconsPlugin')
|
||||
def activate(self):
|
||||
self.active = None
|
||||
roster = app.interface.roster
|
||||
@@ -355,8 +276,8 @@ class ClientsIconsPlugin(GajimPlugin):
|
||||
self.renderer = Gtk.CellRendererPixbuf()
|
||||
client_icon_rend = (
|
||||
'client_icon', self.renderer, False,
|
||||
'pixbuf', self.renderer_num,
|
||||
roster._fill_pep_pixbuf_renderer, self.renderer_num)
|
||||
'icon_name', self.renderer_num,
|
||||
self._roster_icon_renderer, self.renderer_num)
|
||||
# remove old column
|
||||
roster.tree.remove_column(roster.tree.get_column(0))
|
||||
# add new renderer in renderers list
|
||||
@@ -371,11 +292,33 @@ class ClientsIconsPlugin(GajimPlugin):
|
||||
roster.fill_column(col)
|
||||
roster.tree.insert_column(col, 0)
|
||||
# redraw roster
|
||||
roster.columns += [GdkPixbuf.Pixbuf]
|
||||
roster.columns += [str]
|
||||
self.active = True
|
||||
roster.setup_and_draw_roster()
|
||||
|
||||
@log_calls('ClientsIconsPlugin')
|
||||
def _roster_icon_renderer(self, column, renderer, model, titer, data=None):
|
||||
try:
|
||||
type_ = model[titer][Column.TYPE]
|
||||
except TypeError:
|
||||
return
|
||||
|
||||
# allocate space for the icon only if needed
|
||||
if model[titer][data] is None:
|
||||
renderer.set_property('visible', False)
|
||||
else:
|
||||
renderer.set_property('visible', True)
|
||||
|
||||
if type_ == 'account':
|
||||
app.interface.roster._set_account_row_background_color(renderer)
|
||||
renderer.set_property('xalign', 1)
|
||||
elif type_:
|
||||
if not model[titer][Column.JID] or not model[titer][Column.ACCOUNT]:
|
||||
# This can append at the moment we add the row
|
||||
return
|
||||
jid = model[titer][Column.JID]
|
||||
account = model[titer][Column.ACCOUNT]
|
||||
app.interface.roster._set_contact_row_background_color(renderer, jid, account)
|
||||
|
||||
def deactivate(self):
|
||||
self.active = None
|
||||
roster = app.interface.roster
|
||||
@@ -393,139 +336,86 @@ class ClientsIconsPlugin(GajimPlugin):
|
||||
self.renderer_num + 1:]
|
||||
roster.setup_and_draw_roster()
|
||||
|
||||
def caps_disco_received(self, iq_obj):
|
||||
log.debug("caps disco received...")
|
||||
if not self.config['show_in_roster']:
|
||||
return
|
||||
roster = app.interface.roster
|
||||
contact = app.contacts.get_contact_from_full_jid(
|
||||
iq_obj.conn.name, iq_obj.jid)
|
||||
if self.is_groupchat(contact):
|
||||
return
|
||||
if contact is None:
|
||||
room_jid, nick = app.get_room_and_nick_from_fjid(iq_obj.fjid)
|
||||
contact = app.contacts.get_gc_contact(iq_obj.conn.name, room_jid, nick)
|
||||
if contact:
|
||||
gc_control = app.interface.msg_win_mgr.get_gc_control(
|
||||
iq_obj.jid, iq_obj.conn.name)
|
||||
iter_ = gc_control.get_contact_iter(nick)
|
||||
self.set_icon(gc_control.model, iter_,
|
||||
self.muc_renderer_num, None, contact)
|
||||
return
|
||||
if not contact:
|
||||
return
|
||||
child_iters = roster._get_contact_iter(
|
||||
iq_obj.jid, iq_obj.conn.name, contact, roster.model)
|
||||
if not child_iters:
|
||||
return
|
||||
for iter_ in child_iters:
|
||||
caps = contact.client_caps._node
|
||||
caps_ = self.check_jid(iq_obj.jid)
|
||||
if caps_:
|
||||
caps = caps_
|
||||
self.set_icon(roster.model, iter_, self.renderer_num, caps, contact)
|
||||
|
||||
def caps_presence_received(self, iq_obj):
|
||||
log.debug("caps presence received...")
|
||||
if not self.config['show_in_roster']:
|
||||
return
|
||||
roster = app.interface.roster
|
||||
contact = app.contacts.get_contact_with_highest_priority(
|
||||
iq_obj.conn.name, iq_obj.jid)
|
||||
if not contact or self.is_groupchat(contact):
|
||||
return
|
||||
|
||||
if iq_obj.resource == 'local':
|
||||
def _on_caps_update(self, event):
|
||||
if event.conn.name == 'Local':
|
||||
# zeroconf
|
||||
return
|
||||
|
||||
iters = roster._get_contact_iter(iq_obj.jid, iq_obj.conn.name, contact,
|
||||
contact = self._get_contact_or_gc_contact_for_jid(event.conn.name, event.fjid)
|
||||
if contact is None:
|
||||
return
|
||||
|
||||
if contact.is_gc_contact:
|
||||
self._draw_gc_contact(event, contact)
|
||||
else:
|
||||
self._draw_roster_contact(event, contact)
|
||||
|
||||
def _draw_roster_contact(self, event, contact):
|
||||
if not self.config['show_in_roster']:
|
||||
return
|
||||
|
||||
if contact.is_groupchat():
|
||||
return
|
||||
roster = app.interface.roster
|
||||
iters = roster._get_contact_iter(event.jid, event.conn.name, contact,
|
||||
roster.model)
|
||||
iter_ = iters[0]
|
||||
|
||||
if contact.show == 'error':
|
||||
self.set_icon(roster.model, iter_, self.renderer_num, None, contact)
|
||||
# highest contact changed
|
||||
caps = contact.client_caps._node
|
||||
if not caps:
|
||||
return
|
||||
|
||||
# highest contact changed
|
||||
if roster.model[iter_][self.renderer_num] is not None:
|
||||
caps = contact.client_caps._node
|
||||
if caps:
|
||||
log.debug('caps_presence_received, caps: %s', caps)
|
||||
self.set_icon(roster.model, iter_, self.renderer_num, caps, contact)
|
||||
return
|
||||
|
||||
caps = None
|
||||
tag = iq_obj.stanza.getTags('c')
|
||||
if tag:
|
||||
caps = tag[0].getAttr('node')
|
||||
if caps:
|
||||
if 'pidgin.im/' in caps:
|
||||
caps = 'libpurple'
|
||||
for client in LIBPURPLE_CLIENTS:
|
||||
if client in contact.resource.lower():
|
||||
caps = LIBPURPLE_CLIENTS[client]
|
||||
if 'sleekxmpp.com'in caps:
|
||||
caps = 'httр://sleekxmpp.com/ver/1.1.11'
|
||||
|
||||
caps_from_jid = self.check_jid(iq_obj.jid)
|
||||
if caps_from_jid:
|
||||
caps = caps_from_jid
|
||||
|
||||
for iter_ in iters:
|
||||
self.set_icon(roster.model, iter_, self.renderer_num, caps, contact)
|
||||
|
||||
def gc_presence_received(self, iq_obj):
|
||||
log.debug("gc presence received...")
|
||||
def _draw_gc_contact(self, event, contact):
|
||||
if not self.config['show_in_groupchats']:
|
||||
return
|
||||
contact = app.contacts.get_gc_contact(
|
||||
iq_obj.conn.name, iq_obj.presence_obj.jid, iq_obj.nick)
|
||||
if not contact:
|
||||
|
||||
control = app.interface.msg_win_mgr.get_gc_control(contact.room_jid,
|
||||
event.conn.name)
|
||||
if control is None:
|
||||
return
|
||||
caps = None
|
||||
tag = iq_obj.stanza.getTags('c')
|
||||
if tag:
|
||||
caps = tag[0].getAttr('node')
|
||||
if caps:
|
||||
log.debug('gc_presence_received, caps: %s', caps)
|
||||
if 'pidgin.im/' in caps:
|
||||
caps = 'libpurple'
|
||||
if 'sleekxmpp.com' in caps:
|
||||
caps = 'httр://sleekxmpp.com/ver/1.1.11'
|
||||
iter_ = iq_obj.gc_control.get_contact_iter(iq_obj.nick)
|
||||
model = iq_obj.gc_control.model
|
||||
if model[iter_][self.muc_renderer_num] is not None:
|
||||
iter_ = control.get_contact_iter(contact.name)
|
||||
if control.model[iter_][self.muc_renderer_num] is not None:
|
||||
return
|
||||
self.set_icon(model, iter_, self.muc_renderer_num, caps, contact)
|
||||
caps = contact.client_caps._node
|
||||
if not caps:
|
||||
return
|
||||
self.set_icon(control.model, iter_, self.muc_renderer_num, caps, contact)
|
||||
|
||||
def set_icon(self, model, iter_, pos, caps, contact):
|
||||
client_icon = self.get_client_icon_by_name(
|
||||
self.get_client_name(contact, _('Unknown')))
|
||||
def _get_contact_or_gc_contact_for_jid(self, account, fjid):
|
||||
contact = app.contacts.get_contact_from_full_jid(account, fjid)
|
||||
|
||||
if caps and not client_icon:
|
||||
caps_ = caps.split('#')[0].split()
|
||||
if caps_:
|
||||
log.debug('set_icon, caps_: %s', caps_)
|
||||
client_icon = CLIENTS.get(caps_[0].split()[0], (None,))[0]
|
||||
if contact is None:
|
||||
fjid = JID(fjid)
|
||||
room_jid, resource = fjid.getStripped(), fjid.getResource()
|
||||
contact = app.contacts.get_gc_contact(account, room_jid, resource)
|
||||
return contact
|
||||
|
||||
if not client_icon:
|
||||
if self.config['show_unknown_icon']:
|
||||
model[iter_][pos] = self.default_pixbuf
|
||||
else:
|
||||
icon_path = os.path.join(self.local_file_path('icons'), client_icon)
|
||||
if icon_path in self.icon_cache:
|
||||
model[iter_][pos] = self.icon_cache[icon_path]
|
||||
else:
|
||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(icon_path, 16, 16)
|
||||
model[iter_][pos] = pixbuf
|
||||
self.icon_cache[icon_path] = pixbuf
|
||||
def set_icon(self, model, iter_, pos, node, contact):
|
||||
identity_name = self.get_client_identity_name(contact)
|
||||
_client_name, icon_name = clients.get_data(identity_name, node)
|
||||
if 'unknown' in icon_name:
|
||||
if node is not None:
|
||||
log.warning('Unknown client: %s %s', identity_name, node)
|
||||
if not self.config['show_unknown_icon']:
|
||||
model[iter_][pos] = None
|
||||
return
|
||||
|
||||
model[iter_][pos] = icon_name
|
||||
|
||||
def tree_cell_data_func(self, column, renderer, model, iter_, control):
|
||||
if not model.iter_parent(iter_):
|
||||
renderer.set_property('visible', False)
|
||||
return
|
||||
elif model[iter_][self.muc_renderer_num]:
|
||||
|
||||
if model[iter_][self.muc_renderer_num]:
|
||||
renderer.set_property('visible', True)
|
||||
|
||||
contact = app.contacts.get_gc_contact(
|
||||
|
||||
|
Before Width: | Height: | Size: 594 B After Width: | Height: | Size: 594 B |
|
Before Width: | Height: | Size: 804 B After Width: | Height: | Size: 804 B |
|
Before Width: | Height: | Size: 827 B After Width: | Height: | Size: 827 B |
|
Before Width: | Height: | Size: 704 B After Width: | Height: | Size: 704 B |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 798 B After Width: | Height: | Size: 798 B |
|
Before Width: | Height: | Size: 1015 B After Width: | Height: | Size: 1015 B |
|
Before Width: | Height: | Size: 706 B After Width: | Height: | Size: 706 B |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 580 B After Width: | Height: | Size: 580 B |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1018 B After Width: | Height: | Size: 1018 B |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 959 B After Width: | Height: | Size: 959 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 905 B After Width: | Height: | Size: 905 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 963 B After Width: | Height: | Size: 963 B |
|
Before Width: | Height: | Size: 1000 B After Width: | Height: | Size: 1000 B |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 748 B After Width: | Height: | Size: 748 B |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 902 B After Width: | Height: | Size: 902 B |
|
Before Width: | Height: | Size: 817 B After Width: | Height: | Size: 817 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 978 B After Width: | Height: | Size: 978 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 956 B After Width: | Height: | Size: 956 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |