home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.5)
-
- from peak.util.plugins import Hook
- from util.threads import threaded
- from logging import getLogger
- _log = log = getLogger('plugin_hub')
- import traceback
-
- def asyn(identifier, *args, **kwargs):
- threaded(syn)(identifier, *args, **kwargs)
-
-
- def syn(identifier, *args, **kwargs):
- ret = True
- for hook in Hook(identifier):
-
- try:
- ret = hook(*args, **kwargs)
- if not ret:
- ret = False
- continue
- except Exception:
- traceback.print_exc()
- continue
-
-
-
- return ret
-
-
- def act(id, *args, **kwargs):
- if id.endswith('.async'):
- asyn(id, *args, **kwargs)
- else:
- ret = syn(id, *args, **kwargs)
- return ret
-
- hooks = '\nim:\n filetransfer: syn, buddy, file, state\n alert:\n pre: syn, proto, type, param\n msg:\n pre: syn, message, type\n async: syn, msg, type\n my_status_change:\n pre: syn, msg\n async: syn, msg\n setprofile:\n pre: syn, proto, profile\n async: syn, proto, profile\n status_change:\n pre: syn, proto, buddy\n async: syn, proto, buddy\n info:\n pre: syn, proto, buddy, info\n async: syn, proto, buddy, info\n conversation:\n start:\n pre: syn, proto, buddy\n async: syn, proto, buddy\n end:\n async: syn, proto, buddy\n addcontact:\n pre: syn, proto, name, alias\n async: syn, proto, name, alias\n addaccount:\n async: syn, proto_name, acct_name\nupdateaccount:\n async: syn, account\nsocial:\n addaccount:\n async: syn, proto_name, acct_name\n alert: syn, proto, type, msg\nprotocol:\n statechange:\n async: syn, state\nplugin:\n load:\n async: syn\n unload:\n async: syn\ngoidle:\n pre: syn\n async: syn\nunidle:\n pre: syn\n async: syn\nemail:\n newmail:\n pre: syn, proto, address, count, msg\n async: syn, proto, address, count, msg\n addaccount:\n async: syn, proto_name, acct_name\n'
- functemp = "def %(func_name)s(%(def_args)s):\n return %(type)s('%(func_id)s'%(func_args)s)\n"
- from prefs import flatten
- from syck import load
- funcs = flatten(load(hooks))
- for func_id, args in funcs:
- func_id = 'digsby.' + func_id
- args = args.split(', ')
- type = args[0]
- func_args = args[1:]
- def_args = ', '.join(func_args)
- if func_args:
- func_args = ', ' + def_args
- else:
- func_args = ''
- func_name = func_id.replace('.', '_')
- exec (functemp % locals(), globals(), locals())
-
-