forked from indymedia/epicyon
delegate option
parent
4f6e9eb87f
commit
05da296cdb
40
epicyon.py
40
epicyon.py
|
@ -213,6 +213,8 @@ parser.add_argument('--block', dest='block', type=str,default=None, \
|
|||
help='Block a particular address')
|
||||
parser.add_argument('--unblock', dest='unblock', type=str,default=None, \
|
||||
help='Remove a block on a particular address')
|
||||
parser.add_argument('--delegate', dest='delegate', type=str,default=None, \
|
||||
help='Address of an account to delegate a role to')
|
||||
parser.add_argument('--filter', dest='filterStr', type=str,default=None, \
|
||||
help='Adds a word or phrase which if present will cause a message to be ignored')
|
||||
parser.add_argument('--unfilter', dest='unfilterStr', type=str,default=None, \
|
||||
|
@ -731,6 +733,7 @@ if args.availability:
|
|||
sys.exit()
|
||||
|
||||
if args.project:
|
||||
if not args.delegate:
|
||||
if not nickname:
|
||||
print('No nickname given')
|
||||
sys.exit()
|
||||
|
@ -802,6 +805,43 @@ if args.block:
|
|||
time.sleep(1)
|
||||
sys.exit()
|
||||
|
||||
if args.delegate:
|
||||
if not nickname:
|
||||
print('Specify a nickname with the --nickname option')
|
||||
sys.exit()
|
||||
|
||||
if not args.password:
|
||||
print('Specify a password with the --password option')
|
||||
sys.exit()
|
||||
|
||||
if not args.project:
|
||||
print('Specify a project with the --project option')
|
||||
sys.exit()
|
||||
|
||||
if not args.role:
|
||||
print('Specify a role with the --role option')
|
||||
sys.exit()
|
||||
|
||||
if '@' in args.delegate:
|
||||
delegatedNickname=args.delegate.split('@')[0]
|
||||
args.delegate=blockedActor
|
||||
|
||||
session = createSession(domain,port,useTor)
|
||||
personCache={}
|
||||
cachedWebfingers={}
|
||||
print('Sending delegation for '+args.delegate+' with role '+args.role+' in project '+args.project)
|
||||
|
||||
sendRoleViaServer(session,nickname,args.password,
|
||||
domain,port, \
|
||||
httpPrefix,args.delegate, \
|
||||
args.project,args.role, \
|
||||
cachedWebfingers,personCache, \
|
||||
True)
|
||||
for i in range(10):
|
||||
# TODO detect send success/fail
|
||||
time.sleep(1)
|
||||
sys.exit()
|
||||
|
||||
if args.unblock:
|
||||
if not nickname:
|
||||
print('Specify a nickname with the --nickname option')
|
||||
|
|
Loading…
Reference in New Issue