forked from indymedia/epicyon
Approve and deny handles
parent
f13751603d
commit
5cd0390234
12
epicyon.py
12
epicyon.py
|
@ -331,6 +331,9 @@ if args.approve:
|
||||||
if not args.nickname:
|
if not args.nickname:
|
||||||
print('Specify a nickname with the --nickname option')
|
print('Specify a nickname with the --nickname option')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
if '@' not in args.approve:
|
||||||
|
print('syntax: --approve nick@domain')
|
||||||
|
sys.exit()
|
||||||
handle=args.nickname+'@'+domain
|
handle=args.nickname+'@'+domain
|
||||||
accountsDir=baseDir+'/accounts/'+handle
|
accountsDir=baseDir+'/accounts/'+handle
|
||||||
approveFollowsFilename=accountDir+'/followrequests.txt'
|
approveFollowsFilename=accountDir+'/followrequests.txt'
|
||||||
|
@ -338,7 +341,7 @@ if args.approve:
|
||||||
with open(approveFollowsFilename+'.new', 'w') as approvefilenew:
|
with open(approveFollowsFilename+'.new', 'w') as approvefilenew:
|
||||||
with open(approveFollowsFilename, 'r') as approvefile:
|
with open(approveFollowsFilename, 'r') as approvefile:
|
||||||
for approveHandle in approvefile:
|
for approveHandle in approvefile:
|
||||||
if approveHandle.startswith(handle):
|
if approveHandle.startswith(args.approve):
|
||||||
if ':' in approveHandle:
|
if ':' in approveHandle:
|
||||||
port=int(approveHandle.split(':')[1].replace('\n',''))
|
port=int(approveHandle.split(':')[1].replace('\n',''))
|
||||||
# TODO approve follow for handle/port
|
# TODO approve follow for handle/port
|
||||||
|
@ -351,6 +354,9 @@ if args.deny:
|
||||||
if not args.nickname:
|
if not args.nickname:
|
||||||
print('Specify a nickname with the --nickname option')
|
print('Specify a nickname with the --nickname option')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
if '@' not in args.deny:
|
||||||
|
print('syntax: --deny nick@domain')
|
||||||
|
sys.exit()
|
||||||
handle=args.nickname+'@'+domain
|
handle=args.nickname+'@'+domain
|
||||||
accountsDir=baseDir+'/accounts/'+handle
|
accountsDir=baseDir+'/accounts/'+handle
|
||||||
approveFollowsFilename=accountDir+'/followrequests.txt'
|
approveFollowsFilename=accountDir+'/followrequests.txt'
|
||||||
|
@ -358,10 +364,10 @@ if args.deny:
|
||||||
with open(approveFollowsFilename+'.new', 'w') as approvefilenew:
|
with open(approveFollowsFilename+'.new', 'w') as approvefilenew:
|
||||||
with open(approveFollowsFilename, 'r') as approvefile:
|
with open(approveFollowsFilename, 'r') as approvefile:
|
||||||
for approveHandle in approvefile:
|
for approveHandle in approvefile:
|
||||||
if not approveHandle.startswith(handle):
|
if not approveHandle.startswith(args.deny):
|
||||||
approvefilenew.write(approveHandle)
|
approvefilenew.write(approveHandle)
|
||||||
os.rename(approveFollowsFilename+'.new',approveFollowsFilename)
|
os.rename(approveFollowsFilename+'.new',approveFollowsFilename)
|
||||||
print('Follow request from '+handle+' was denied.')
|
print('Follow request from '+args.deny+' was denied.')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
if args.followerspending:
|
if args.followerspending:
|
||||||
|
|
Loading…
Reference in New Issue