diff options
author | Carlo von lynX <lynX@time.to.get.psyced.org> | 2016-05-08 10:06:53 +0000 |
---|---|---|
committer | Carlo von lynX <lynX@time.to.get.psyced.org> | 2016-05-08 10:06:53 +0000 |
commit | ea6351c2f3d49f818e846276072e8d2b59bf1fa5 (patch) | |
tree | 7f421e7a366009fd6eef21c21f0d2ac27b375d9e /src/social/gnunet-social.c | |
parent | 11c4dbe993aec1c81310e0c6d72c8bcddbec7496 (diff) | |
download | gnunet-ea6351c2f3d49f818e846276072e8d2b59bf1fa5.tar.gz gnunet-ea6351c2f3d49f818e846276072e8d2b59bf1fa5.zip |
cmdline usability for gnunet-social
Diffstat (limited to 'src/social/gnunet-social.c')
-rw-r--r-- | src/social/gnunet-social.c | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/src/social/gnunet-social.c b/src/social/gnunet-social.c index a3ad95270..0d236b2ff 100644 --- a/src/social/gnunet-social.c +++ b/src/social/gnunet-social.c | |||
@@ -64,11 +64,11 @@ static int op_guest_leave; | |||
64 | /** --guest-talk */ | 64 | /** --guest-talk */ |
65 | static int op_guest_talk; | 65 | static int op_guest_talk; |
66 | 66 | ||
67 | /** --history-replay */ | 67 | /** --replay */ |
68 | static char *op_history_replay; | 68 | static char *op_replay; |
69 | 69 | ||
70 | /** --history-replay-latest */ | 70 | /** --replay-latest */ |
71 | static char *op_history_replay_latest; | 71 | static char *op_replay_latest; |
72 | 72 | ||
73 | /** --look-at */ | 73 | /** --look-at */ |
74 | static int op_look_at; | 74 | static int op_look_at; |
@@ -97,11 +97,11 @@ static char *opt_peer; | |||
97 | /** --follow */ | 97 | /** --follow */ |
98 | static int opt_follow; | 98 | static int opt_follow; |
99 | 99 | ||
100 | /** --admit */ | 100 | /** --welcome */ |
101 | static int opt_admit; | 101 | static int opt_welcome; |
102 | 102 | ||
103 | /** --refuse */ | 103 | /** --deny */ |
104 | static int opt_refuse; | 104 | static int opt_deny; |
105 | 105 | ||
106 | /** --method */ | 106 | /** --method */ |
107 | static char *opt_method; | 107 | static char *opt_method; |
@@ -116,8 +116,8 @@ static char *opt_name; | |||
116 | /** --start */ | 116 | /** --start */ |
117 | static uint64_t opt_start; | 117 | static uint64_t opt_start; |
118 | 118 | ||
119 | /** --end */ | 119 | /** --until */ |
120 | static uint64_t opt_end; | 120 | static uint64_t opt_until; |
121 | 121 | ||
122 | /** --limit */ | 122 | /** --limit */ |
123 | static int opt_limit; | 123 | static int opt_limit; |
@@ -352,7 +352,7 @@ recv_history_replay_result (void *cls, int64_t result, | |||
352 | "%.*s\n", | 352 | "%.*s\n", |
353 | result, data_size, (const char *) data); | 353 | result, data_size, (const char *) data); |
354 | 354 | ||
355 | if (op_history_replay || op_history_replay_latest) | 355 | if (op_replay || op_replay_latest) |
356 | { | 356 | { |
357 | exit_success (); | 357 | exit_success (); |
358 | } | 358 | } |
@@ -628,7 +628,7 @@ host_answer_door (void *cls, | |||
628 | "Entry request: %s\n", nym_str); | 628 | "Entry request: %s\n", nym_str); |
629 | GNUNET_free (nym_str); | 629 | GNUNET_free (nym_str); |
630 | 630 | ||
631 | if (opt_admit) | 631 | if (opt_welcome) |
632 | { | 632 | { |
633 | struct GNUNET_PSYC_Message * | 633 | struct GNUNET_PSYC_Message * |
634 | resp = GNUNET_PSYC_message_create ("_notice_place_admit", env, | 634 | resp = GNUNET_PSYC_message_create ("_notice_place_admit", env, |
@@ -636,7 +636,7 @@ host_answer_door (void *cls, | |||
636 | GNUNET_SOCIAL_host_entry_decision (hst, nym, GNUNET_YES, resp); | 636 | GNUNET_SOCIAL_host_entry_decision (hst, nym, GNUNET_YES, resp); |
637 | GNUNET_free (resp); | 637 | GNUNET_free (resp); |
638 | } | 638 | } |
639 | else if (opt_refuse) | 639 | else if (opt_deny) |
640 | { | 640 | { |
641 | struct GNUNET_PSYC_Message * | 641 | struct GNUNET_PSYC_Message * |
642 | resp = GNUNET_PSYC_message_create ("_notice_place_refuse", NULL, | 642 | resp = GNUNET_PSYC_message_create ("_notice_place_refuse", NULL, |
@@ -709,10 +709,10 @@ host_enter () | |||
709 | static void | 709 | static void |
710 | place_reconnected () | 710 | place_reconnected () |
711 | { | 711 | { |
712 | if (op_history_replay) { | 712 | if (op_replay) { |
713 | history_replay (opt_start, opt_end, opt_method); | 713 | history_replay (opt_start, opt_until, opt_method); |
714 | } | 714 | } |
715 | else if (op_history_replay_latest) { | 715 | else if (op_replay_latest) { |
716 | history_replay_latest (opt_limit, opt_method); | 716 | history_replay_latest (opt_limit, opt_method); |
717 | } | 717 | } |
718 | else if (op_look_at) { | 718 | else if (op_look_at) { |
@@ -824,7 +824,7 @@ app_recv_host (void *cls, | |||
824 | GNUNET_free (host_pub_str); | 824 | GNUNET_free (host_pub_str); |
825 | 825 | ||
826 | if ((op_host_reconnect || op_host_leave || op_host_announce | 826 | if ((op_host_reconnect || op_host_leave || op_host_announce |
827 | || op_history_replay || op_history_replay_latest | 827 | || op_replay || op_replay_latest |
828 | || op_look_at || op_look_for) | 828 | || op_look_at || op_look_for) |
829 | && 0 == memcmp (&place_pub_key, host_pub_key, sizeof (*host_pub_key))) | 829 | && 0 == memcmp (&place_pub_key, host_pub_key, sizeof (*host_pub_key))) |
830 | { | 830 | { |
@@ -848,7 +848,7 @@ app_recv_guest (void *cls, | |||
848 | GNUNET_free (guest_pub_str); | 848 | GNUNET_free (guest_pub_str); |
849 | 849 | ||
850 | if ((op_guest_reconnect || op_guest_leave || op_guest_talk | 850 | if ((op_guest_reconnect || op_guest_leave || op_guest_talk |
851 | || op_history_replay || op_history_replay_latest | 851 | || op_replay || op_replay_latest |
852 | || op_look_at || op_look_for) | 852 | || op_look_at || op_look_for) |
853 | && 0 == memcmp (&place_pub_key, guest_pub_key, sizeof (*guest_pub_key))) | 853 | && 0 == memcmp (&place_pub_key, guest_pub_key, sizeof (*guest_pub_key))) |
854 | { | 854 | { |
@@ -928,7 +928,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
928 | if (! (op_status | 928 | if (! (op_status |
929 | || op_host_enter || op_host_reconnect || op_host_leave || op_host_announce | 929 | || op_host_enter || op_host_reconnect || op_host_leave || op_host_announce |
930 | || op_guest_enter || op_guest_reconnect || op_guest_leave || op_guest_talk | 930 | || op_guest_enter || op_guest_reconnect || op_guest_leave || op_guest_talk |
931 | || op_history_replay || op_history_replay_latest | 931 | || op_replay || op_replay_latest |
932 | || op_look_at || op_look_for)) | 932 | || op_look_at || op_look_for)) |
933 | { | 933 | { |
934 | op_status = 1; | 934 | op_status = 1; |
@@ -942,7 +942,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
942 | if ((op_host_reconnect || op_host_leave || op_host_announce | 942 | if ((op_host_reconnect || op_host_leave || op_host_announce |
943 | || op_guest_reconnect || (op_guest_enter && !opt_gns) | 943 | || op_guest_reconnect || (op_guest_enter && !opt_gns) |
944 | || op_guest_leave || op_guest_talk | 944 | || op_guest_leave || op_guest_talk |
945 | || op_history_replay || op_history_replay_latest | 945 | || op_replay || op_replay_latest |
946 | || op_look_at || op_look_for) | 946 | || op_look_at || op_look_for) |
947 | && (!opt_place | 947 | && (!opt_place |
948 | || GNUNET_OK != GNUNET_CRYPTO_eddsa_public_key_from_string (opt_place, | 948 | || GNUNET_OK != GNUNET_CRYPTO_eddsa_public_key_from_string (opt_place, |
@@ -991,6 +991,10 @@ main (int argc, char *const *argv) | |||
991 | 991 | ||
992 | /* operations */ | 992 | /* operations */ |
993 | 993 | ||
994 | { 'B', "guest-leave", NULL, | ||
995 | gettext_noop ("say good-bye and leave somebody else's place"), | ||
996 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_guest_leave }, | ||
997 | |||
994 | { 'C', "host-enter", NULL, | 998 | { 'C', "host-enter", NULL, |
995 | gettext_noop ("create a place"), | 999 | gettext_noop ("create a place"), |
996 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_enter }, | 1000 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_enter }, |
@@ -1007,13 +1011,9 @@ main (int argc, char *const *argv) | |||
1007 | gettext_noop ("find state matching name prefix"), | 1011 | gettext_noop ("find state matching name prefix"), |
1008 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_look_for }, | 1012 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_look_for }, |
1009 | 1013 | ||
1010 | { 'H', "history-replay-latest", NULL, | 1014 | { 'H', "replay-latest", NULL, |
1011 | gettext_noop ("replay history of latest messages up to the given --limit"), | 1015 | gettext_noop ("replay history of messages up to the given --limit"), |
1012 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_history_replay_latest }, | 1016 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_replay_latest }, |
1013 | |||
1014 | { 'L', "guest-leave", NULL, | ||
1015 | gettext_noop ("leave somebody else's place"), | ||
1016 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_guest_leave }, | ||
1017 | 1017 | ||
1018 | { 'N', "host-reconnect", NULL, | 1018 | { 'N', "host-reconnect", NULL, |
1019 | gettext_noop ("reconnect to a previously created place"), | 1019 | gettext_noop ("reconnect to a previously created place"), |
@@ -1039,9 +1039,9 @@ main (int argc, char *const *argv) | |||
1039 | gettext_noop ("list of egos and subscribed places"), | 1039 | gettext_noop ("list of egos and subscribed places"), |
1040 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_status }, | 1040 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_status }, |
1041 | 1041 | ||
1042 | { 'X', "history-replay", NULL, | 1042 | { 'X', "replay", NULL, |
1043 | gettext_noop ("extract and replay history between message IDs --start and --end"), | 1043 | gettext_noop ("extract and replay history between message IDs --start and --until"), |
1044 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_history_replay }, | 1044 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_replay }, |
1045 | 1045 | ||
1046 | 1046 | ||
1047 | /* options */ | 1047 | /* options */ |
@@ -1062,28 +1062,28 @@ main (int argc, char *const *argv) | |||
1062 | gettext_noop ("wait for incoming messages"), | 1062 | gettext_noop ("wait for incoming messages"), |
1063 | GNUNET_NO, &GNUNET_GETOPT_set_one, &opt_follow }, | 1063 | GNUNET_NO, &GNUNET_GETOPT_set_one, &opt_follow }, |
1064 | 1064 | ||
1065 | { 'g', "gns", "GNS_NAME", | ||
1066 | gettext_noop ("GNS name"), | ||
1067 | GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_gns }, | ||
1068 | |||
1065 | { 'i', "peer", "PEER_ID", | 1069 | { 'i', "peer", "PEER_ID", |
1066 | gettext_noop ("peer ID for --guest-enter"), | 1070 | gettext_noop ("peer ID for --guest-enter"), |
1067 | GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_peer }, | 1071 | GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_peer }, |
1068 | 1072 | ||
1069 | { 'k', "name", "VAR_NAME", | 1073 | { 'k', "name", "VAR_NAME", |
1070 | gettext_noop ("state var name to query"), | 1074 | gettext_noop ("state variable name (key) to query"), |
1071 | GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_name }, | 1075 | GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_name }, |
1072 | 1076 | ||
1073 | { 'l', "limit", NULL, | ||
1074 | gettext_noop ("number of messages to replay from history"), | ||
1075 | GNUNET_YES, &GNUNET_GETOPT_set_ulong, &opt_limit }, | ||
1076 | |||
1077 | { 'm', "method", "METHOD_NAME", | 1077 | { 'm', "method", "METHOD_NAME", |
1078 | gettext_noop ("method name"), | 1078 | gettext_noop ("method name"), |
1079 | GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_method }, | 1079 | GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_method }, |
1080 | 1080 | ||
1081 | { 'n', "gns", "GNS_NAME", | 1081 | { 'n', "limit", NULL, |
1082 | gettext_noop ("GNS name"), | 1082 | gettext_noop ("number of messages to replay from history"), |
1083 | GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_gns }, | 1083 | GNUNET_YES, &GNUNET_GETOPT_set_ulong, &opt_limit }, |
1084 | 1084 | ||
1085 | { 'p', "place", "PUBKEY", | 1085 | { 'p', "place", "PUBKEY", |
1086 | gettext_noop ("public key of place"), | 1086 | gettext_noop ("key address of place"), |
1087 | GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_place }, | 1087 | GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_place }, |
1088 | 1088 | ||
1089 | { 's', "start", NULL, | 1089 | { 's', "start", NULL, |
@@ -1092,15 +1092,15 @@ main (int argc, char *const *argv) | |||
1092 | 1092 | ||
1093 | { 'w', "welcome", NULL, | 1093 | { 'w', "welcome", NULL, |
1094 | gettext_noop ("respond to entry requests by admitting all guests"), | 1094 | gettext_noop ("respond to entry requests by admitting all guests"), |
1095 | GNUNET_NO, &GNUNET_GETOPT_set_one, &opt_admit }, | 1095 | GNUNET_NO, &GNUNET_GETOPT_set_one, &opt_welcome }, |
1096 | 1096 | ||
1097 | { 'u', "until", NULL, | 1097 | { 'u', "until", NULL, |
1098 | gettext_noop ("end message ID for history replay"), | 1098 | gettext_noop ("end message ID for history replay"), |
1099 | GNUNET_YES, &GNUNET_GETOPT_set_ulong, &opt_end }, | 1099 | GNUNET_YES, &GNUNET_GETOPT_set_ulong, &opt_until }, |
1100 | 1100 | ||
1101 | { 'y', "deny", NULL, | 1101 | { 'y', "deny", NULL, |
1102 | gettext_noop ("respond to entry requests by refusing all guests"), | 1102 | gettext_noop ("respond to entry requests by refusing all guests"), |
1103 | GNUNET_NO, &GNUNET_GETOPT_set_one, &opt_refuse }, | 1103 | GNUNET_NO, &GNUNET_GETOPT_set_one, &opt_deny }, |
1104 | 1104 | ||
1105 | GNUNET_GETOPT_OPTION_END | 1105 | GNUNET_GETOPT_OPTION_END |
1106 | }; | 1106 | }; |
@@ -1113,8 +1113,8 @@ main (int argc, char *const *argv) | |||
1113 | const char *usage = | 1113 | const char *usage = |
1114 | "gnunet-social [--status]\n" | 1114 | "gnunet-social [--status]\n" |
1115 | "\n" | 1115 | "\n" |
1116 | "gnunet-social --host-enter --ego <NAME or PUBKEY> [--follow] [--admit | --refuse]\n" | 1116 | "gnunet-social --host-enter --ego <NAME or PUBKEY> [--follow] [--welcome | --deny]\n" |
1117 | "gnunet-social --host-reconnect --place <PUBKEY> [--follow] [--admit | --refuse]\n" | 1117 | "gnunet-social --host-reconnect --place <PUBKEY> [--follow] [--welcome | --deny]\n" |
1118 | "gnunet-social --host-leave --place <PUBKEY>\n" | 1118 | "gnunet-social --host-leave --place <PUBKEY>\n" |
1119 | "gnunet-social --host-announce --place <PUBKEY> --method <METHOD_NAME> --body <MESSAGE_BODY>\n" | 1119 | "gnunet-social --host-announce --place <PUBKEY> --method <METHOD_NAME> --body <MESSAGE_BODY>\n" |
1120 | "\n" | 1120 | "\n" |
@@ -1124,7 +1124,7 @@ main (int argc, char *const *argv) | |||
1124 | "gnunet-social --guest-leave --place <PUBKEY>\n" | 1124 | "gnunet-social --guest-leave --place <PUBKEY>\n" |
1125 | "gnunet-social --guest-talk --place <PUBKEY> --method <METHOD_NAME> --body <MESSAGE_BODY>\n" | 1125 | "gnunet-social --guest-talk --place <PUBKEY> --method <METHOD_NAME> --body <MESSAGE_BODY>\n" |
1126 | "\n" | 1126 | "\n" |
1127 | "gnunet-social --history-replay --place <PUBKEY> --start <MSGID> --end <MSGID> [--method <METHOD_PREFIX>]\n" | 1127 | "gnunet-social --history-replay --place <PUBKEY> --start <MSGID> --until <MSGID> [--method <METHOD_PREFIX>]\n" |
1128 | "gnunet-social --history-replay-latest --place <PUBKEY> --limit <MSG_LIMIT> [--method <METHOD_PREFIX>]\n" | 1128 | "gnunet-social --history-replay-latest --place <PUBKEY> --limit <MSG_LIMIT> [--method <METHOD_PREFIX>]\n" |
1129 | "\n" | 1129 | "\n" |
1130 | "gnunet-social --look-at --place <PUBKEY> --name <FULL_NAME>\n" | 1130 | "gnunet-social --look-at --place <PUBKEY> --name <FULL_NAME>\n" |