diff options
Diffstat (limited to 'src/social/gnunet-social.c')
-rw-r--r-- | src/social/gnunet-social.c | 291 |
1 files changed, 225 insertions, 66 deletions
diff --git a/src/social/gnunet-social.c b/src/social/gnunet-social.c index e0b5273ac..b59aab77c 100644 --- a/src/social/gnunet-social.c +++ b/src/social/gnunet-social.c | |||
@@ -29,9 +29,12 @@ | |||
29 | #include "platform.h" | 29 | #include "platform.h" |
30 | #include "gnunet_util_lib.h" | 30 | #include "gnunet_util_lib.h" |
31 | #include "gnunet_social_service.h" | 31 | #include "gnunet_social_service.h" |
32 | #include "gnunet_core_service.h" | ||
32 | 33 | ||
33 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) | 34 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) |
34 | 35 | ||
36 | #define DATA2ARG(data) data, sizeof (data) | ||
37 | |||
35 | /* operations corresponding to API calls */ | 38 | /* operations corresponding to API calls */ |
36 | 39 | ||
37 | /** --host-enter */ | 40 | /** --host-enter */ |
@@ -76,6 +79,9 @@ static char *opt_place; | |||
76 | /** --ego */ | 79 | /** --ego */ |
77 | static char *opt_ego; | 80 | static char *opt_ego; |
78 | 81 | ||
82 | /** --peer */ | ||
83 | static char *opt_peer; | ||
84 | |||
79 | /** --follow */ | 85 | /** --follow */ |
80 | static int opt_follow; | 86 | static int opt_follow; |
81 | 87 | ||
@@ -130,13 +136,17 @@ struct GNUNET_SOCIAL_Guest *gst; | |||
130 | struct GNUNET_SOCIAL_Place *plc; | 136 | struct GNUNET_SOCIAL_Place *plc; |
131 | 137 | ||
132 | 138 | ||
139 | /* DISCONNECT */ | ||
140 | |||
141 | |||
133 | static void | 142 | static void |
134 | cleanup () | 143 | disconnect () |
135 | { | 144 | { |
136 | 145 | GNUNET_SOCIAL_app_disconnect (app); | |
146 | GNUNET_CORE_disconnect (core); | ||
147 | GNUNET_SCHEDULER_shutdown (); | ||
137 | } | 148 | } |
138 | 149 | ||
139 | |||
140 | /** | 150 | /** |
141 | * Terminate the test case (failure). | 151 | * Terminate the test case (failure). |
142 | * | 152 | * |
@@ -145,75 +155,216 @@ cleanup () | |||
145 | static void | 155 | static void |
146 | timeout (void *cls) | 156 | timeout (void *cls) |
147 | { | 157 | { |
148 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout\n"); | 158 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout.\n"); |
149 | cleanup (); | 159 | disconnect (); |
160 | } | ||
161 | |||
162 | static void | ||
163 | schedule_end (void *cls) | ||
164 | { | ||
165 | ret = 0; | ||
166 | disconnect (); | ||
150 | } | 167 | } |
151 | 168 | ||
152 | 169 | ||
153 | static void | 170 | static void |
154 | host_leave (struct GNUNET_SOCIAL_Host *host) | 171 | end () |
155 | { | 172 | { |
173 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "The end.\n"); | ||
156 | 174 | ||
175 | if (timeout_task != NULL) | ||
176 | { | ||
177 | GNUNET_SCHEDULER_cancel (timeout_task); | ||
178 | timeout_task = NULL; | ||
179 | } | ||
180 | GNUNET_SCHEDULER_add_now (&schedule_end, NULL); | ||
157 | } | 181 | } |
158 | 182 | ||
159 | 183 | ||
184 | /* LEAVE */ | ||
185 | |||
186 | |||
160 | static void | 187 | static void |
161 | host_announce (struct GNUNET_SOCIAL_Host *host, | 188 | host_left () |
162 | const char *method, | ||
163 | const char *data) | ||
164 | { | 189 | { |
190 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
191 | "The host has left the place.\n"); | ||
192 | end (); | ||
193 | } | ||
194 | |||
165 | 195 | ||
196 | static void | ||
197 | host_leave () | ||
198 | { | ||
199 | GNUNET_SOCIAL_host_leave (hst, NULL, &host_left, NULL); | ||
200 | hst = NULL; | ||
201 | plc = NULL; | ||
166 | } | 202 | } |
167 | 203 | ||
168 | 204 | ||
169 | static void | 205 | static void |
170 | guest_leave (struct GNUNET_SOCIAL_Guest *guest) | 206 | guest_left (void *cls) |
171 | { | 207 | { |
208 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
209 | "The guest has left the place.\n"); | ||
210 | } | ||
211 | |||
172 | 212 | ||
213 | static void | ||
214 | guest_leave () | ||
215 | { | ||
216 | struct GNUNET_PSYC_Environment *env = GNUNET_PSYC_env_create (); | ||
217 | GNUNET_PSYC_env_add (env, GNUNET_PSYC_OP_SET, | ||
218 | "_notice_place_leave", DATA2ARG ("Leaving.")); | ||
219 | GNUNET_SOCIAL_guest_leave (gst, env, &guest_left, NULL); | ||
220 | GNUNET_PSYC_env_destroy (env); | ||
221 | gst = NULL; | ||
222 | plc = NULL; | ||
223 | } | ||
224 | |||
225 | |||
226 | /* ANNOUNCE / TALK */ | ||
227 | |||
228 | |||
229 | struct TransmitClosure | ||
230 | { | ||
231 | const char *data; | ||
232 | size_t size; | ||
233 | } tmit; | ||
234 | |||
235 | |||
236 | static int | ||
237 | notify_data (void *cls, uint16_t *data_size, void *data) | ||
238 | { | ||
239 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
240 | "Transmit notify data: %u bytes available\n", | ||
241 | *data_size); | ||
242 | |||
243 | struct TransmitClosure *tmit = cls; | ||
244 | uint16_t size = tmit->size < *data_size ? tmit->size : *data_size; | ||
245 | *data_size = size; | ||
246 | memcpy (data, tmit->data, size); | ||
247 | |||
248 | tmit->size -= size; | ||
249 | tmit->data += size; | ||
250 | |||
251 | return 0 == tmit->size ? GNUNET_NO : GNUNET_YES; | ||
173 | } | 252 | } |
174 | 253 | ||
175 | 254 | ||
176 | static void | 255 | static void |
177 | guest_talk (struct GNUNET_SOCIAL_Guest *guest, | 256 | host_announce (const char *method, const char *data, size_t data_size) |
178 | const char *method, | ||
179 | const char *data) | ||
180 | { | 257 | { |
258 | struct GNUNET_PSYC_Environment *env = GNUNET_PSYC_env_create (); | ||
259 | GNUNET_PSYC_env_add (env, GNUNET_PSYC_OP_SET, | ||
260 | "_foo", DATA2ARG ("bar baz")); | ||
261 | |||
262 | tmit = (struct TransmitClosure) {}; | ||
263 | tmit.data = data; | ||
264 | tmit.size = data_size; | ||
181 | 265 | ||
266 | GNUNET_SOCIAL_host_announce (hst, method, env, | ||
267 | ¬ify_data, &tmit, | ||
268 | GNUNET_SOCIAL_ANNOUNCE_NONE); | ||
182 | } | 269 | } |
183 | 270 | ||
184 | 271 | ||
185 | static void | 272 | static void |
186 | history_replay (struct GNUNET_SOCIAL_Place *place, | 273 | guest_talk (const char *method, |
187 | uint64_t start, uint64_t end, const char *prefix) | 274 | const char *data, size_t data_size) |
188 | { | 275 | { |
276 | struct GNUNET_PSYC_Environment *env = GNUNET_PSYC_env_create (); | ||
277 | GNUNET_PSYC_env_add (env, GNUNET_PSYC_OP_SET, | ||
278 | "_foo", DATA2ARG ("bar baz")); | ||
279 | |||
280 | tmit = (struct TransmitClosure) {}; | ||
281 | tmit.data = data; | ||
282 | tmit.size = data_size; | ||
189 | 283 | ||
284 | GNUNET_SOCIAL_guest_talk (gst, method, env, | ||
285 | ¬ify_data, &tmit, | ||
286 | GNUNET_SOCIAL_TALK_NONE); | ||
190 | } | 287 | } |
191 | 288 | ||
192 | 289 | ||
290 | /* HISTORY REPLAY */ | ||
291 | |||
292 | |||
193 | static void | 293 | static void |
194 | history_replay_latest (struct GNUNET_SOCIAL_Place *place, | 294 | recv_history_replay_result (void *cls, int64_t result, |
195 | uint64_t limit, const char *prefix) | 295 | const void *data, uint16_t data_size) |
196 | { | 296 | { |
297 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
298 | "Guest received history replay result: %" PRId64 "\n" | ||
299 | "%.*s\n", | ||
300 | result, data_size, (const char *) data); | ||
301 | } | ||
197 | 302 | ||
303 | |||
304 | static void | ||
305 | history_replay (uint64_t start, uint64_t end, const char *prefix) | ||
306 | { | ||
307 | GNUNET_SOCIAL_place_history_replay (plc, start, end, prefix, | ||
308 | GNUNET_PSYC_HISTORY_REPLAY_LOCAL, | ||
309 | slicer, | ||
310 | &recv_history_replay_result, | ||
311 | NULL); | ||
198 | } | 312 | } |
199 | 313 | ||
200 | 314 | ||
201 | static void | 315 | static void |
202 | look_at (struct GNUNET_SOCIAL_Place *place, | 316 | history_replay_latest (uint64_t limit, const char *prefix) |
203 | const char *name) | 317 | { |
318 | GNUNET_SOCIAL_place_history_replay_latest (plc, limit, prefix, | ||
319 | GNUNET_PSYC_HISTORY_REPLAY_LOCAL, | ||
320 | slicer, | ||
321 | &recv_history_replay_result, | ||
322 | NULL); | ||
323 | } | ||
324 | |||
325 | |||
326 | /* LOOK AT/FOR */ | ||
327 | |||
328 | |||
329 | static void | ||
330 | look_result (void *cls, int64_t result_code, | ||
331 | const void *data, uint16_t data_size) | ||
204 | { | 332 | { |
333 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
334 | "look_result: %" PRId64 "\n", result_code); | ||
205 | 335 | ||
206 | } | 336 | } |
207 | 337 | ||
208 | 338 | ||
209 | static void | 339 | static void |
210 | look_for (struct GNUNET_SOCIAL_Place *place, | 340 | look_var (void *cls, |
211 | const char *name) | 341 | const struct GNUNET_MessageHeader *mod, |
342 | const char *name, | ||
343 | const void *value, | ||
344 | uint32_t value_size, | ||
345 | uint32_t full_value_size) | ||
212 | { | 346 | { |
347 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
348 | "guest_look_at_var: %s\n%.*s\n", | ||
349 | name, value_size, (const char *) value); | ||
350 | } | ||
351 | |||
213 | 352 | ||
353 | static void | ||
354 | look_at (const char *name) | ||
355 | { | ||
356 | GNUNET_SOCIAL_place_look_at (plc, name, look_var, look_result, NULL); | ||
214 | } | 357 | } |
215 | 358 | ||
216 | /* SLICER + CALLBACKS */ | 359 | |
360 | static void | ||
361 | look_for (const char *name) | ||
362 | { | ||
363 | GNUNET_SOCIAL_place_look_for (plc, name, look_var, look_result, NULL); | ||
364 | } | ||
365 | |||
366 | |||
367 | /* SLICER */ | ||
217 | 368 | ||
218 | 369 | ||
219 | static void | 370 | static void |
@@ -244,7 +395,7 @@ slicer_recv_modifier (void *cls, | |||
244 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 395 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
245 | "Received modifier for message ID %" PRIu64 ":\n" | 396 | "Received modifier for message ID %" PRIu64 ":\n" |
246 | "%c%s: %.*s (size: %u)\n", | 397 | "%c%s: %.*s (size: %u)\n", |
247 | message_id, oper, name, value_size, value, value_size); | 398 | message_id, oper, name, value_size, (const char *) value, value_size); |
248 | } | 399 | } |
249 | 400 | ||
250 | 401 | ||
@@ -259,7 +410,7 @@ slicer_recv_data (void *cls, | |||
259 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 410 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
260 | "Received data for message ID %" PRIu64 ":\n" | 411 | "Received data for message ID %" PRIu64 ":\n" |
261 | "%.*s\n", | 412 | "%.*s\n", |
262 | message_id, data_size, data); | 413 | message_id, data_size, (const char *) data); |
263 | } | 414 | } |
264 | 415 | ||
265 | 416 | ||
@@ -290,7 +441,7 @@ slicer_create () | |||
290 | } | 441 | } |
291 | 442 | ||
292 | 443 | ||
293 | /* GUEST ENTER + CALLBACKS */ | 444 | /* GUEST ENTER */ |
294 | 445 | ||
295 | 446 | ||
296 | static void | 447 | static void |
@@ -315,7 +466,7 @@ guest_recv_entry_decision (void *cls, | |||
315 | 466 | ||
316 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 467 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
317 | "%s\n%.*s\n", | 468 | "%s\n%.*s\n", |
318 | method_name, data_size, data); | 469 | method_name, data_size, (const char *) data); |
319 | } | 470 | } |
320 | } | 471 | } |
321 | 472 | ||
@@ -338,7 +489,7 @@ guest_enter_msg_create () | |||
338 | const char *method_name = "_request_enter"; | 489 | const char *method_name = "_request_enter"; |
339 | struct GNUNET_PSYC_Environment *env = GNUNET_PSYC_env_create (); | 490 | struct GNUNET_PSYC_Environment *env = GNUNET_PSYC_env_create (); |
340 | GNUNET_PSYC_env_add (env, GNUNET_PSYC_OP_SET, | 491 | GNUNET_PSYC_env_add (env, GNUNET_PSYC_OP_SET, |
341 | "_foo", "bar", sizeof ("bar")); | 492 | "_foo", DATA2ARG ("bar")); |
342 | void *data = "let me in"; | 493 | void *data = "let me in"; |
343 | uint16_t data_size = strlen (data) + 1; | 494 | uint16_t data_size = strlen (data) + 1; |
344 | 495 | ||
@@ -347,8 +498,7 @@ guest_enter_msg_create () | |||
347 | 498 | ||
348 | 499 | ||
349 | static void | 500 | static void |
350 | guest_enter (const struct GNUNET_CRYPTO_EddsaPublicKey *place_pub_key, | 501 | guest_enter (struct GNUNET_PeerIdentity *peer) |
351 | struct GNUNET_PeerIdentity *peer) | ||
352 | { | 502 | { |
353 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 503 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
354 | "Entering to place as guest.\n"); | 504 | "Entering to place as guest.\n"); |
@@ -377,8 +527,7 @@ guest_enter_by_name (const char *gns_name) | |||
377 | } | 527 | } |
378 | 528 | ||
379 | 529 | ||
380 | 530 | /* HOST ENTER */ | |
381 | /* HOST ENTER + CALLBACKS */ | ||
382 | 531 | ||
383 | 532 | ||
384 | static void | 533 | static void |
@@ -442,22 +591,23 @@ host_enter () | |||
442 | } | 591 | } |
443 | 592 | ||
444 | 593 | ||
445 | /* RECONNECT CALLBACKS */ | 594 | /* PLACE RECONNECT */ |
595 | |||
446 | 596 | ||
447 | static void | 597 | static void |
448 | place_reconnected () | 598 | place_reconnected () |
449 | { | 599 | { |
450 | if (op_history_replay) { | 600 | if (op_history_replay) { |
451 | history_replay (plc, opt_start, opt_end, opt_method); | 601 | history_replay (opt_start, opt_end, opt_method); |
452 | } | 602 | } |
453 | else if (op_history_replay_latest) { | 603 | else if (op_history_replay_latest) { |
454 | history_replay_latest (plc, opt_limit, opt_method); | 604 | history_replay_latest (opt_limit, opt_method); |
455 | } | 605 | } |
456 | else if (op_look_at) { | 606 | else if (op_look_at) { |
457 | look_at (plc, opt_name); | 607 | look_at (opt_name); |
458 | } | 608 | } |
459 | else if (op_look_for) { | 609 | else if (op_look_for) { |
460 | look_for (plc, opt_name); | 610 | look_for (opt_name); |
461 | } | 611 | } |
462 | } | 612 | } |
463 | 613 | ||
@@ -471,10 +621,10 @@ host_reconnected (void *cls, int result, | |||
471 | "Host reconnected\n"); | 621 | "Host reconnected\n"); |
472 | 622 | ||
473 | if (op_host_leave) { | 623 | if (op_host_leave) { |
474 | host_leave (hst); | 624 | host_leave (); |
475 | } | 625 | } |
476 | else if (op_host_announce) { | 626 | else if (op_host_announce) { |
477 | host_announce (hst, opt_method, opt_data); | 627 | host_announce (opt_method, opt_data, strlen (opt_data)); |
478 | } | 628 | } |
479 | else { | 629 | else { |
480 | place_reconnected (); | 630 | place_reconnected (); |
@@ -491,10 +641,10 @@ guest_reconnected (void *cls, int result, | |||
491 | "Guest reconnected\n"); | 641 | "Guest reconnected\n"); |
492 | 642 | ||
493 | if (op_guest_leave) { | 643 | if (op_guest_leave) { |
494 | guest_leave (gst); | 644 | guest_leave (); |
495 | } | 645 | } |
496 | else if (op_guest_talk) { | 646 | else if (op_guest_talk) { |
497 | guest_talk (gst, opt_method, opt_data); | 647 | guest_talk (opt_method, opt_data, strlen (opt_data)); |
498 | } | 648 | } |
499 | else { | 649 | else { |
500 | place_reconnected (); | 650 | place_reconnected (); |
@@ -502,7 +652,7 @@ guest_reconnected (void *cls, int result, | |||
502 | } | 652 | } |
503 | 653 | ||
504 | 654 | ||
505 | /* APP CALLBACKS */ | 655 | /* APP */ |
506 | 656 | ||
507 | 657 | ||
508 | static void | 658 | static void |
@@ -515,7 +665,8 @@ app_connected (void *cls) | |||
515 | host_enter (); | 665 | host_enter (); |
516 | } | 666 | } |
517 | else if (op_guest_enter) { | 667 | else if (op_guest_enter) { |
518 | guest_enter (&place_pub_key); | 668 | guest_enter (&peer); |
669 | // FIXME: guest_enter_by_name | ||
519 | } | 670 | } |
520 | } | 671 | } |
521 | 672 | ||
@@ -530,7 +681,7 @@ app_recv_host (void *cls, | |||
530 | struct GNUNET_HashCode host_pub_hash; | 681 | struct GNUNET_HashCode host_pub_hash; |
531 | GNUNET_CRYPTO_hash (host_pub_key, sizeof (*host_pub_key), &host_pub_hash); | 682 | GNUNET_CRYPTO_hash (host_pub_key, sizeof (*host_pub_key), &host_pub_hash); |
532 | char * | 683 | char * |
533 | host_pub_str = GNUNET_CRYPTO_ecdsa_public_key_to_string (guest_pub_key); | 684 | host_pub_str = GNUNET_CRYPTO_eddsa_public_key_to_string (host_pub_key); |
534 | 685 | ||
535 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 686 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
536 | "Host: %s (%s)\n", | 687 | "Host: %s (%s)\n", |
@@ -556,7 +707,7 @@ app_recv_guest (void *cls, | |||
556 | struct GNUNET_HashCode guest_pub_hash; | 707 | struct GNUNET_HashCode guest_pub_hash; |
557 | GNUNET_CRYPTO_hash (guest_pub_key, sizeof (*guest_pub_key), &guest_pub_hash); | 708 | GNUNET_CRYPTO_hash (guest_pub_key, sizeof (*guest_pub_key), &guest_pub_hash); |
558 | char * | 709 | char * |
559 | guest_pub_str = GNUNET_CRYPTO_ecdsa_public_key_to_string (guest_pub_key); | 710 | guest_pub_str = GNUNET_CRYPTO_eddsa_public_key_to_string (guest_pub_key); |
560 | 711 | ||
561 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 712 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
562 | "Guest: %s (%s)\n", | 713 | "Guest: %s (%s)\n", |
@@ -595,7 +746,8 @@ app_connect () | |||
595 | NULL); | 746 | NULL); |
596 | } | 747 | } |
597 | 748 | ||
598 | /* CORE CALLBACKS */ | 749 | |
750 | /* CORE */ | ||
599 | 751 | ||
600 | 752 | ||
601 | static void | 753 | static void |
@@ -606,6 +758,9 @@ core_connected (void *cls, const struct GNUNET_PeerIdentity *my_identity) | |||
606 | } | 758 | } |
607 | 759 | ||
608 | 760 | ||
761 | /* RUN */ | ||
762 | |||
763 | |||
609 | /** | 764 | /** |
610 | * Main function run by the scheduler. | 765 | * Main function run by the scheduler. |
611 | * | 766 | * |
@@ -628,7 +783,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
628 | if (op_host_enter && NULL != opt_place) | 783 | if (op_host_enter && NULL != opt_place) |
629 | { | 784 | { |
630 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 785 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
631 | _ ("--place must not be specified when using --host-enter\n")); | 786 | _("--place must not be specified when using --host-enter\n")); |
632 | return; | 787 | return; |
633 | } | 788 | } |
634 | 789 | ||
@@ -638,7 +793,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
638 | &place_pub_key)) | 793 | &place_pub_key)) |
639 | { | 794 | { |
640 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 795 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
641 | _ ("--place missing or invalid.\n")); | 796 | _("--place missing or invalid.\n")); |
642 | return; | 797 | return; |
643 | } | 798 | } |
644 | 799 | ||
@@ -674,77 +829,81 @@ main (int argc, char *const *argv) | |||
674 | /* operations */ | 829 | /* operations */ |
675 | 830 | ||
676 | { 'E', "host-enter", NULL, | 831 | { 'E', "host-enter", NULL, |
677 | _ ("create a place for nyms to join"), | 832 | gettext_noop ("create a place for nyms to join"), |
678 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_enter }, | 833 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_enter }, |
679 | 834 | ||
680 | { 'L', "host-leave", NULL, | 835 | { 'L', "host-leave", NULL, |
681 | _ ("destroy a place we were hosting"), | 836 | gettext_noop ("destroy a place we were hosting"), |
682 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_leave }, | 837 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_leave }, |
683 | 838 | ||
684 | { 'A', "host-announce", NULL, | 839 | { 'A', "host-announce", NULL, |
685 | _ ("publish something to a place we are hosting"), | 840 | gettext_noop ("publish something to a place we are hosting"), |
686 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_announce }, | 841 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_announce }, |
687 | 842 | ||
688 | { 'e', "guest-enter", NULL, | 843 | { 'e', "guest-enter", NULL, |
689 | _ ("join somebody else's place"), | 844 | gettext_noop ("join somebody else's place"), |
690 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_guest_enter }, | 845 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_guest_enter }, |
691 | 846 | ||
692 | { 'l', "guest-leave", NULL, | 847 | { 'l', "guest-leave", NULL, |
693 | _ ("leave somebody else's place"), | 848 | gettext_noop ("leave somebody else's place"), |
694 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_guest_leave }, | 849 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_guest_leave }, |
695 | 850 | ||
696 | { 't', "guest-talk", NULL, | 851 | { 't', "guest-talk", NULL, |
697 | _ ("submit something to somebody's place"), | 852 | gettext_noop ("submit something to somebody's place"), |
698 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_guest_talk }, | 853 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_guest_talk }, |
699 | 854 | ||
700 | { 'R', "history-replay", NULL, | 855 | { 'R', "history-replay", NULL, |
701 | _ ("replay history of messages between message IDs --start and --end"), | 856 | gettext_noop ("replay history of messages between message IDs --start and --end"), |
702 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_history_replay }, | 857 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_history_replay }, |
703 | 858 | ||
704 | { 'r', "history-replay-latest", NULL, | 859 | { 'r', "history-replay-latest", NULL, |
705 | _ ("replay history of latest messages up to the given --limit"), | 860 | gettext_noop ("replay history of latest messages up to the given --limit"), |
706 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_history_replay_latest }, | 861 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_history_replay_latest }, |
707 | 862 | ||
708 | /* options */ | 863 | /* options */ |
709 | 864 | ||
710 | { 'A', "app", "application ID", | 865 | { 'A', "app", "application ID", |
711 | _ ("application ID to use when connecting"), | 866 | gettext_noop ("application ID to use when connecting"), |
712 | GNUNET_NO, &GNUNET_GETOPT_set_string, &opt_app }, | 867 | GNUNET_NO, &GNUNET_GETOPT_set_string, &opt_app }, |
713 | 868 | ||
714 | { 'p', "place", "PUBKEY", | 869 | { 'p', "place", "PUBKEY", |
715 | _ ("public key of place"), | 870 | gettext_noop ("public key of place"), |
716 | GNUNET_NO, &GNUNET_GETOPT_set_string, &opt_place }, | 871 | GNUNET_NO, &GNUNET_GETOPT_set_string, &opt_place }, |
717 | 872 | ||
873 | { 'P', "peer", "PEER_ID", | ||
874 | gettext_noop ("peer ID for --guest-enter"), | ||
875 | GNUNET_NO, &GNUNET_GETOPT_set_string, &opt_peer }, | ||
876 | |||
718 | { 'g', "ego", "PUBKEY", | 877 | { 'g', "ego", "PUBKEY", |
719 | _ ("public key of ego"), | 878 | gettext_noop ("public key of ego"), |
720 | GNUNET_NO, &GNUNET_GETOPT_set_string, &opt_place }, | 879 | GNUNET_NO, &GNUNET_GETOPT_set_string, &opt_place }, |
721 | 880 | ||
722 | { 'f', "follow", NULL, | 881 | { 'f', "follow", NULL, |
723 | _ ("wait for incoming messages"), | 882 | gettext_noop ("wait for incoming messages"), |
724 | GNUNET_NO, &GNUNET_GETOPT_set_one, &opt_follow }, | 883 | GNUNET_NO, &GNUNET_GETOPT_set_one, &opt_follow }, |
725 | 884 | ||
726 | { 'm', "method", "METHOD_NAME", | 885 | { 'm', "method", "METHOD_NAME", |
727 | _ ("method name"), | 886 | gettext_noop ("method name"), |
728 | GNUNET_NO, &GNUNET_GETOPT_set_string, &opt_method }, | 887 | GNUNET_NO, &GNUNET_GETOPT_set_string, &opt_method }, |
729 | 888 | ||
730 | { 'd', "data", "DATA", | 889 | { 'd', "data", "DATA", |
731 | _ ("message body to transmit"), | 890 | gettext_noop ("message body to transmit"), |
732 | GNUNET_NO, &GNUNET_GETOPT_set_string, &opt_data }, | 891 | GNUNET_NO, &GNUNET_GETOPT_set_string, &opt_data }, |
733 | 892 | ||
734 | { 'n', "name", "VAR_NAME", | 893 | { 'n', "name", "VAR_NAME", |
735 | _ ("state var name to query"), | 894 | gettext_noop ("state var name to query"), |
736 | GNUNET_NO, &GNUNET_GETOPT_set_string, &opt_name }, | 895 | GNUNET_NO, &GNUNET_GETOPT_set_string, &opt_name }, |
737 | 896 | ||
738 | { 'a', "start", NULL, | 897 | { 'a', "start", NULL, |
739 | _ ("start message ID for history replay"), | 898 | gettext_noop ("start message ID for history replay"), |
740 | GNUNET_NO, &GNUNET_GETOPT_set_ulong, &opt_start }, | 899 | GNUNET_NO, &GNUNET_GETOPT_set_ulong, &opt_start }, |
741 | 900 | ||
742 | { 'z', "end", NULL, | 901 | { 'z', "end", NULL, |
743 | _ ("end message ID for history replay"), | 902 | gettext_noop ("end message ID for history replay"), |
744 | GNUNET_NO, &GNUNET_GETOPT_set_ulong, &opt_end }, | 903 | GNUNET_NO, &GNUNET_GETOPT_set_ulong, &opt_end }, |
745 | 904 | ||
746 | { 'n', "limit", NULL, | 905 | { 'n', "limit", NULL, |
747 | _ ("number of messages to replay from history"), | 906 | gettext_noop ("number of messages to replay from history"), |
748 | GNUNET_NO, &GNUNET_GETOPT_set_ulong, &opt_limit }, | 907 | GNUNET_NO, &GNUNET_GETOPT_set_ulong, &opt_limit }, |
749 | 908 | ||
750 | GNUNET_GETOPT_OPTION_END | 909 | GNUNET_GETOPT_OPTION_END |
@@ -754,7 +913,7 @@ main (int argc, char *const *argv) | |||
754 | return 2; | 913 | return 2; |
755 | 914 | ||
756 | const char *help = | 915 | const char *help = |
757 | _ ("interact with the social service: enter/leave, send/receive messages, access history and state")m; | 916 | _ ("interact with the social service: enter/leave, send/receive messages, access history and state"); |
758 | const char *usage = | 917 | const char *usage = |
759 | "gnunet-social --host-enter --ego <name or pubkey> [--listen]\n" | 918 | "gnunet-social --host-enter --ego <name or pubkey> [--listen]\n" |
760 | "gnunet-social --host-leave --place <pubkey>\n" | 919 | "gnunet-social --host-leave --place <pubkey>\n" |