mirror of https://gitlab.com/bashrc2/epicyon
Add calendar event parameters when sending c2s post
parent
4b433644ca
commit
c41069cf90
|
@ -466,6 +466,9 @@ def _desktop_reply_to_post(session, post_id: str,
|
|||
comments_enabled = True
|
||||
city = 'London, England'
|
||||
say_str = 'Sending reply'
|
||||
event_date = None
|
||||
event_time = None
|
||||
location = None
|
||||
_say_command(say_str, say_str, screenreader, system_language, espeak)
|
||||
if send_post_via_server(signing_priv_key_pem, __version__,
|
||||
base_dir, session, nickname, password,
|
||||
|
@ -477,6 +480,7 @@ def _desktop_reply_to_post(session, post_id: str,
|
|||
cached_webfingers, person_cache, is_article,
|
||||
system_language, languages_understood,
|
||||
low_bandwidth, content_license_url,
|
||||
event_date, event_time, location,
|
||||
debug, post_id, post_id,
|
||||
conversation_id, subject) == 0:
|
||||
say_str = 'Reply sent'
|
||||
|
@ -535,6 +539,9 @@ def _desktop_new_post(session,
|
|||
comments_enabled = True
|
||||
subject = None
|
||||
say_str = 'Sending'
|
||||
event_date = None
|
||||
event_time = None
|
||||
location = None
|
||||
_say_command(say_str, say_str, screenreader, system_language, espeak)
|
||||
if send_post_via_server(signing_priv_key_pem, __version__,
|
||||
base_dir, session, nickname, password,
|
||||
|
@ -546,6 +553,7 @@ def _desktop_new_post(session,
|
|||
cached_webfingers, person_cache, is_article,
|
||||
system_language, languages_understood,
|
||||
low_bandwidth, content_license_url,
|
||||
event_date, event_time, location,
|
||||
debug, None, None,
|
||||
conversation_id, subject) == 0:
|
||||
say_str = 'Post sent'
|
||||
|
@ -1260,6 +1268,10 @@ def _desktop_new_dm_base(session, to_handle: str,
|
|||
_say_command(say_str, say_str, screenreader, system_language, espeak)
|
||||
return
|
||||
|
||||
event_date = None
|
||||
event_time = None
|
||||
location = None
|
||||
|
||||
say_str = 'Sending'
|
||||
_say_command(say_str, say_str, screenreader, system_language, espeak)
|
||||
if send_post_via_server(signing_priv_key_pem, __version__,
|
||||
|
@ -1272,6 +1284,7 @@ def _desktop_new_dm_base(session, to_handle: str,
|
|||
cached_webfingers, person_cache, is_article,
|
||||
system_language, languages_understood,
|
||||
low_bandwidth, content_license_url,
|
||||
event_date, event_time, location,
|
||||
debug, None, None,
|
||||
conversation_id, subject) == 0:
|
||||
say_str = 'Direct message sent'
|
||||
|
|
27
epicyon.py
27
epicyon.py
|
@ -119,6 +119,17 @@ def str2bool(value_str) -> bool:
|
|||
|
||||
search_date = datetime.datetime.now()
|
||||
parser = argparse.ArgumentParser(description='ActivityPub Server')
|
||||
parser.add_argument('--eventDate', type=str,
|
||||
default=None,
|
||||
help='Date for an event when sending a c2s post' +
|
||||
' YYYY-MM-DD')
|
||||
parser.add_argument('--eventTime', type=str,
|
||||
default=None,
|
||||
help='Time for an event when sending a c2s post' +
|
||||
' HH:MM')
|
||||
parser.add_argument('--eventLocation', type=str,
|
||||
default=None,
|
||||
help='Location for an event when sending a c2s post')
|
||||
parser.add_argument('--content_license_url', type=str,
|
||||
default='https://creativecommons.org/licenses/by/4.0',
|
||||
help='Url of the license used for the instance content')
|
||||
|
@ -1310,6 +1321,16 @@ if args.message:
|
|||
print('Specify a nickname with the --nickname option')
|
||||
sys.exit()
|
||||
|
||||
if args.eventDate:
|
||||
if '-' not in args.eventDate or len(args.eventDate) != 10:
|
||||
print('Event date format should be YYYY-MM-DD')
|
||||
sys.exit()
|
||||
|
||||
if args.eventTime:
|
||||
if ':' not in args.eventTime or len(args.eventTime) != 5:
|
||||
print('Event time format should be HH:MM')
|
||||
sys.exit()
|
||||
|
||||
if not args.password:
|
||||
args.password = getpass.getpass('Password: ')
|
||||
if not args.password:
|
||||
|
@ -1370,8 +1391,8 @@ if args.message:
|
|||
if args.secure_mode:
|
||||
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
|
||||
languages_understood = [args.language]
|
||||
print('Sending post to ' + args.sendto)
|
||||
|
||||
print('Sending post to ' + args.sendto)
|
||||
send_post_via_server(signing_priv_key_pem, __version__,
|
||||
base_dir, session, args.nickname, args.password,
|
||||
domain, port,
|
||||
|
@ -1382,7 +1403,9 @@ if args.message:
|
|||
cached_webfingers, person_cache, is_article,
|
||||
args.language, languages_understood,
|
||||
args.low_bandwidth,
|
||||
args.content_license_url, args.debug,
|
||||
args.content_license_url,
|
||||
args.eventDate, args.eventTime, args.eventLocation,
|
||||
args.debug,
|
||||
reply_to, reply_to, args.conversationId, subject)
|
||||
for i in range(10):
|
||||
# TODO detect send success/fail
|
||||
|
|
7
posts.py
7
posts.py
|
@ -2490,6 +2490,8 @@ def send_post_via_server(signing_priv_key_pem: str, project_version: str,
|
|||
languages_understood: [],
|
||||
low_bandwidth: bool,
|
||||
content_license_url: str,
|
||||
event_date: str, event_time: str,
|
||||
location: str,
|
||||
debug: bool = False,
|
||||
in_reply_to: str = None,
|
||||
in_reply_to_atom_uri: str = None,
|
||||
|
@ -2574,8 +2576,9 @@ def send_post_via_server(signing_priv_key_pem: str, project_version: str,
|
|||
image_description, city,
|
||||
False, is_article, in_reply_to,
|
||||
in_reply_to_atom_uri, subject,
|
||||
False, None, None, None, None, None,
|
||||
None, None, None,
|
||||
False,
|
||||
event_date, event_time, location,
|
||||
None, None, None, None, None,
|
||||
None, None, None, None, None, system_language,
|
||||
conversation_id, low_bandwidth,
|
||||
content_license_url, languages_understood)
|
||||
|
|
7
tests.py
7
tests.py
|
@ -2981,6 +2981,12 @@ def test_client_to_server(base_dir: str):
|
|||
if os.path.isfile(os.path.join(bob_outbox_path, name))]) == 0
|
||||
print('EVENT: all inboxes and outboxes are empty')
|
||||
signing_priv_key_pem = None
|
||||
test_date = datetime.datetime.now()
|
||||
event_date = \
|
||||
str(test_date.year) + '-' + str(test_date.month) + '-' + \
|
||||
str(test_date.day)
|
||||
event_time = '11:45'
|
||||
location = "Kinshasa"
|
||||
send_result = \
|
||||
send_post_via_server(signing_priv_key_pem, __version__,
|
||||
alice_dir, session_alice, 'alice', password,
|
||||
|
@ -2993,6 +2999,7 @@ def test_client_to_server(base_dir: str):
|
|||
cached_webfingers, person_cache, is_article,
|
||||
system_language, languages_understood,
|
||||
low_bandwidth, content_license_url,
|
||||
event_date, event_time, location,
|
||||
True, None, None,
|
||||
conversation_id, None)
|
||||
print('send_result: ' + str(send_result))
|
||||
|
|
Loading…
Reference in New Issue