Ejemplo n.º 1
0
 def substitue_aliases():
     '''
     Swap out buddy names with their allies
     '''
     import gui
     with open(gui.skin.resourcedir() / 'html' / 'jquery-1.3.2.js', 'rb') as f:
         viewer.RunScript(f.read())
     buddy = buddylist.SelectedBuddy
     aliases = IAliasProvider(profile())
     import simplejson as json
     names = set(json.loads(viewer.RunScript("var foo = []; $('.buddy').each(function(){foo.push($(this).html())}); JSON.stringify(foo);")))
     for name in names:
         alias = aliases.get_alias(name, buddy.service, buddy.protocol) or name
         viewer.RunScript(SUBHTML % (json.dumps(name), json.dumps(alias)))
Ejemplo n.º 2
0
def GetBuddies(id):
    acctdir = id['logdir'] / id['proto'] / id['acct']
    buddies = []
    aliases = IAliasProvider(profile())
    for bdir in acctdir.dirs():
        try:
            name, service = bdir.name.rsplit('_', 1)
            serviceicon = skin.get('serviceicons.'+service,None).ResizedSmaller(16)
        except Exception:
            continue
        buddies.append(Storage(icon = serviceicon,
                               name = name,
                               alias = aliases.get_alias(name.lower(), service, acctdir.parent.name) or name,
                               protocol = acctdir.parent.name,
                               service = service,
                               dir = bdir))

    buddies.sort(key=lambda s: s.alias.lower())

    return buddies
Ejemplo n.º 3
0
 def store_remote_alias(self, obj, attr, old, new):
     if attr is None or attr == 'remote_alias':
         IAliasProvider(profile()).set_alias(self.name,
                                             self.service,
                                             protocol=self.protocol.service,
                                             alias=self.alias)