From: Christian Grothoff Date: Wed, 2 Oct 2013 17:10:22 +0000 (+0000) Subject: -fix indentation, minor leaks X-Git-Tag: initial-import-from-subversion-38251~6870 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=17e35f0a3eabb698ac7a0e34e096d64ab3a6d123;p=oweals%2Fgnunet.git -fix indentation, minor leaks --- diff --git a/src/conversation/conversation_api.c b/src/conversation/conversation_api.c index c3fe8c960..5bd88c01f 100644 --- a/src/conversation/conversation_api.c +++ b/src/conversation/conversation_api.c @@ -81,54 +81,54 @@ struct GNUNET_CONVERSATION_CallInformation struct GNUNET_CONVERSATION_Handle { - /** - * Our configuration. - */ + /** + * Our configuration. + */ const struct GNUNET_CONFIGURATION_Handle *cfg; - /** - * Handle to the server connection, to send messages later - */ + /** + * Handle to the server connection, to send messages later + */ struct GNUNET_CLIENT_Connection *client; - /** - * GNS handle - */ + /** + * GNS handle + */ struct GNUNET_GNS_Handle *gns; - /** - * Namestore handle - */ + /** + * Namestore handle + */ struct GNUNET_NAMESTORE_Handle *namestore; - /** - * TXT record for gns - */ + /** + * TXT record for gns + */ int txt_record_set; - /** - * Callback for incoming calls - */ + /** + * Callback for incoming calls + */ GNUNET_CONVERSATION_CallHandler *call_handler; - /** - * Callback for rejected calls - */ + /** + * Callback for rejected calls + */ GNUNET_CONVERSATION_RejectHandler *reject_handler; - - /** - * Callback for notifications - */ + + /** + * Callback for notifications + */ GNUNET_CONVERSATION_NotificationHandler *notification_handler; - /** - * Callback for missed calls - */ + /** + * Callback for missed calls + */ GNUNET_CONVERSATION_MissedCallHandler *missed_call_handler; - /** - * The pointer to the call - */ + /** + * The pointer to the call + */ struct GNUNET_CONVERSATION_CallInformation *call; }; @@ -210,26 +210,24 @@ check_gns_cb (void *cls, uint32_t rd_count, { h->txt_record_set = GNUNET_YES; } - - return; } + /** -* Check if the gns txt record for conversation exits -*/ + * Check if the gns txt record for conversation exits + */ static void check_gns (struct GNUNET_CONVERSATION_Handle *h) { - GNUNET_GNS_lookup (h->gns, "conversation.gads", + GNUNET_GNS_lookup (h->gns, "conversation.gns", NULL /* FIXME_ZONE */, GNUNET_DNSPARSER_TYPE_TXT, GNUNET_NO, NULL, &check_gns_cb, h); - - return; } + /******************************************************************************/ /*********************** RECEIVE HANDLERS ****************************/ /******************************************************************************/ @@ -241,7 +239,8 @@ check_gns (struct GNUNET_CONVERSATION_Handle *h) * @param msg message received, NULL on timeout or fatal error */ static void -receive_message_cb (void *cls, const struct GNUNET_MessageHeader *msg) +receive_message_cb (void *cls, + const struct GNUNET_MessageHeader *msg) { struct GNUNET_CONVERSATION_Handle *h = cls; struct ServerClientSessionInitiateMessage *imsg; @@ -532,6 +531,7 @@ accept_call (struct GNUNET_CONVERSATION_Handle *h) &transmit_session_accept_message, h); } + /** * Auxiliary function to reject a call. * @@ -547,6 +547,7 @@ reject_call (struct GNUNET_CONVERSATION_Handle *h) &transmit_session_reject_message, h); } + /** * Auxiliary function to terminate a call. * @@ -563,9 +564,10 @@ terminate_call (struct GNUNET_CONVERSATION_Handle *h) h); } + /** -* -*/ + * + */ static void gns_call_cb (void *cls, uint32_t rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) @@ -635,15 +637,17 @@ gns_lookup_and_call (struct GNUNET_CONVERSATION_Handle *h, const char *callee) /******************************************************************************/ struct GNUNET_CONVERSATION_Handle * -GNUNET_CONVERSATION_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls, - GNUNET_CONVERSATION_CallHandler * call_handler, - GNUNET_CONVERSATION_RejectHandler * reject_handler, - GNUNET_CONVERSATION_NotificationHandler * notification_handler, - GNUNET_CONVERSATION_MissedCallHandler * missed_call_handler) +GNUNET_CONVERSATION_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, + void *cls, + GNUNET_CONVERSATION_CallHandler call_handler, + GNUNET_CONVERSATION_RejectHandler reject_handler, + GNUNET_CONVERSATION_NotificationHandler notification_handler, + GNUNET_CONVERSATION_MissedCallHandler missed_call_handler) { struct GNUNET_CONVERSATION_Handle *h; - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "GNUNET_CONVERSATION_connect()\n"); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "GNUNET_CONVERSATION_connect()\n"); h = GNUNET_malloc (sizeof (struct GNUNET_CONVERSATION_Handle)); h->cfg = cfg; @@ -690,6 +694,7 @@ GNUNET_CONVERSATION_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void return h; } + void GNUNET_CONVERSATION_disconnect (struct GNUNET_CONVERSATION_Handle *handle) { @@ -732,6 +737,7 @@ GNUNET_CONVERSATION_call (struct GNUNET_CONVERSATION_Handle *h, initiate_call (h, peer); } + void GNUNET_CONVERSATION_hangup (struct GNUNET_CONVERSATION_Handle *h) { @@ -741,6 +747,7 @@ GNUNET_CONVERSATION_hangup (struct GNUNET_CONVERSATION_Handle *h) terminate_call (h); } + void GNUNET_CONVERSATION_accept (struct GNUNET_CONVERSATION_Handle *h) { @@ -750,6 +757,7 @@ GNUNET_CONVERSATION_accept (struct GNUNET_CONVERSATION_Handle *h) accept_call (h); } + void GNUNET_CONVERSATION_reject (struct GNUNET_CONVERSATION_Handle *h) { diff --git a/src/conversation/gnunet-conversation.c b/src/conversation/gnunet-conversation.c index 60130c6d5..a4088984b 100644 --- a/src/conversation/gnunet-conversation.c +++ b/src/conversation/gnunet-conversation.c @@ -32,19 +32,20 @@ #define MAX_MESSAGE_LENGTH (32 * 1024) /** -* CONVERSATION handle -*/ -struct GNUNET_CONVERSATION_Handle *conversation = NULL; + * CONVERSATION handle + */ +static struct GNUNET_CONVERSATION_Handle *conversation; /** -* Task which handles the commands -*/ + * Task which handles the commands + */ static GNUNET_SCHEDULER_TaskIdentifier handle_cmd_task; /** -* Function declareation for executing a action -*/ -typedef int (*ActionFunction) (const char *argumetns, const void *xtra); + * Function declareation for executing a action + */ +typedef int (*ActionFunction) (const char *argumetns, + const void *xtra); /** * Structure which defines a command @@ -56,15 +57,10 @@ struct VoipCommand const char *helptext; }; -/******************************************************************************/ -/*********************** DECLARATIONS *************************/ -/******************************************************************************/ - -static int do_help (const char *args, const void *xtra); -/******************************************************************************/ -/*********************** Functions *************************/ -/******************************************************************************/ +static int +do_help (const char *args, + const void *xtra); /** @@ -167,7 +163,8 @@ missed_call_handler (void *cls, struct GNUNET_CONVERSATION_Handle *handle, struct GNUNET_CONVERSATION_MissedCallNotification *missed_calls) { - FPRINTF (stdout, _("You have missed calls.\n")); + FPRINTF (stdout, + _("You have missed calls.\n")); } @@ -189,7 +186,9 @@ static int do_unknown (const char *msg, const void *xtra) { - FPRINTF (stderr, _("Unknown command `%s'\n"), msg); + FPRINTF (stderr, + _("Unknown command `%s'\n"), + msg); return GNUNET_OK; } @@ -201,13 +200,11 @@ static int do_call (const char *arg, const void *xtra) { - char *callee = GNUNET_strdup (arg); - FPRINTF (stdout, _("Initiating call to: %s\n"), - callee); + arg); GNUNET_CONVERSATION_call (conversation, - callee, + arg, GNUNET_YES); return GNUNET_OK; } @@ -220,13 +217,12 @@ static int do_call_peer (const char *arg, const void *xtra) { - char *callee = GNUNET_strdup (arg); - FPRINTF (stdout, _("Initiating call to: %s\n"), - callee); - GNUNET_CONVERSATION_call (conversation, callee, GNUNET_NO); - + arg); + GNUNET_CONVERSATION_call (conversation, + arg, + GNUNET_NO); return GNUNET_OK; } @@ -278,7 +274,7 @@ do_hang_up (const char *args, * List of supported commands. */ static struct VoipCommand commands[] = { - {"/call ", &do_call, gettext_noop ("Use `/call gads_record'")}, + {"/call ", &do_call, gettext_noop ("Use `/call gns_name'")}, {"/callpeer ", &do_call_peer, gettext_noop ("Use `/call private_key' to call a person")}, {"/accept", &do_accept, diff --git a/src/include/gnunet_conversation_service.h b/src/include/gnunet_conversation_service.h index 555e91adf..6b01119d8 100644 --- a/src/include/gnunet_conversation_service.h +++ b/src/include/gnunet_conversation_service.h @@ -93,8 +93,7 @@ struct GNUNET_CONVERSATION_Handle; * @param caller peer that calls you */ typedef void (GNUNET_CONVERSATION_CallHandler) (void *cls, - struct - GNUNET_CONVERSATION_Handle *handle, + struct GNUNET_CONVERSATION_Handle *handle, const struct GNUNET_PeerIdentity *caller);