Option for undoing shared item

master
Bob Mottram 2019-07-23 22:45:53 +01:00
parent 9a55f9010d
commit cf90074789
1 changed files with 33 additions and 5 deletions

View File

@ -236,8 +236,10 @@ parser.add_argument('--domainmax', dest='domainMaxPostsPerDay', type=int,default
help='Maximum number of received posts from a domain per day') help='Maximum number of received posts from a domain per day')
parser.add_argument('--accountmax', dest='accountMaxPostsPerDay', type=int,default=8640, \ parser.add_argument('--accountmax', dest='accountMaxPostsPerDay', type=int,default=8640, \
help='Maximum number of received posts from an account per day') help='Maximum number of received posts from an account per day')
parser.add_argument('--name', dest='name', type=str,default=None, \ parser.add_argument('--itemName', dest='itemName', type=str,default=None, \
help='Name of an item being shared') help='Name of an item being shared')
parser.add_argument('--undoItemName', dest='undoItemName', type=str,default=None, \
help='Name of an shared item to remove')
parser.add_argument('--summary', dest='summary', type=str,default=None, \ parser.add_argument('--summary', dest='summary', type=str,default=None, \
help='Description of an item being shared') help='Description of an item being shared')
parser.add_argument('--itemImage', dest='itemImage', type=str,default=None, \ parser.add_argument('--itemImage', dest='itemImage', type=str,default=None, \
@ -484,7 +486,7 @@ if args.announce:
time.sleep(1) time.sleep(1)
sys.exit() sys.exit()
if args.name: if args.itemName:
if not args.password: if not args.password:
print('Specify a password with the --password option') print('Specify a password with the --password option')
sys.exit() sys.exit()
@ -516,13 +518,13 @@ if args.name:
session = createSession(domain,port,useTor) session = createSession(domain,port,useTor)
personCache={} personCache={}
cachedWebfingers={} cachedWebfingers={}
print('Sending shared item: '+args.name) print('Sending shared item: '+args.itemName)
sendShareViaServer(session, \ sendShareViaServer(session, \
args.nickname,args.password, \ args.nickname,args.password, \
domain,port, \ domain,port, \
httpPrefix, \ httpPrefix, \
args.name, \ args.itemName, \
args.summary, \ args.summary, \
args.itemImage, \ args.itemImage, \
args.itemType, \ args.itemType, \
@ -535,7 +537,33 @@ if args.name:
# TODO detect send success/fail # TODO detect send success/fail
time.sleep(1) time.sleep(1)
sys.exit() sys.exit()
if args.undoItemName:
if not args.password:
print('Specify a password with the --password option')
sys.exit()
if not args.nickname:
print('Specify a nickname with the --nickname option')
sys.exit()
session = createSession(domain,port,useTor)
personCache={}
cachedWebfingers={}
print('Sending undo of shared item: '+args.undoItemName)
sendUndoShareViaServer(session, \
args.nickname,args.password, \
domain,port, \
httpPrefix, \
args.undoItemName, \
cachedWebfingers,personCache, \
debug)
for i in range(10):
# TODO detect send success/fail
time.sleep(1)
sys.exit()
if args.like: if args.like:
if not args.nickname: if not args.nickname:
print('Specify a nickname with the --nickname option') print('Specify a nickname with the --nickname option')