[refactor] add prefix to public functions of teleport-server

This commit is contained in:
Julian Sparber
2017-10-02 20:30:13 +02:00
parent b0d90da48a
commit 3eb040a84b
4 changed files with 18 additions and 9 deletions

View File

@@ -168,7 +168,7 @@ teleport_app_activate (GApplication *app) {
create_finished_notification ("USER", 2000, "FILENAME", value); create_finished_notification ("USER", 2000, "FILENAME", value);
*/ */
run_http_server(); teleport_server_run();
teleport_publish_run ((gchar *) g_get_host_name()); teleport_publish_run ((gchar *) g_get_host_name());
teleport_browser_run_avahi_service(peerList); teleport_browser_run_avahi_service(peerList);
} }

View File

@@ -7,8 +7,8 @@
#include <libsoup/soup.h> #include <libsoup/soup.h>
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include "teleport-get.h"
#include "teleport-server.h" #include "teleport-server.h"
#include "teleport-get.h"
#include "teleport-app.h" #include "teleport-app.h"
static int port; static int port;
@@ -147,7 +147,11 @@ do_get (SoupServer *server, SoupMessage *msg, const char *path)
soup_message_set_status (msg, SOUP_STATUS_OK); soup_message_set_status (msg, SOUP_STATUS_OK);
} }
static void handle_incoming_file(const char *hash, const char *filename, const int size, const char *origin) { static void
handle_incoming_file(const char *hash,
const char *filename,
const int size,
const char *origin) {
GVariantBuilder *builder; GVariantBuilder *builder;
GVariant *value; GVariant *value;
@@ -241,7 +245,10 @@ server_callback (SoupServer *server, SoupMessage *msg,
g_print (" -> %d %s\n\n", msg->status_code, msg->reason_phrase); g_print (" -> %d %s\n\n", msg->status_code, msg->reason_phrase);
} }
int addRouteToServer(char *name, char *file_to_send, char *destination) { int
teleport_server_add_route (gchar *name,
gchar *file_to_send,
gchar *destination) {
GFile *file; GFile *file;
GFileInfo *fileInfo; GFileInfo *fileInfo;
soup_server_add_handler (glob_server, g_strdup_printf("/transfer/%s", name), soup_server_add_handler (glob_server, g_strdup_printf("/transfer/%s", name),
@@ -263,7 +270,8 @@ int addRouteToServer(char *name, char *file_to_send, char *destination) {
return 0; return 0;
} }
extern int run_http_server(void) { int
teleport_server_run (void) {
GSList *uris, *u; GSList *uris, *u;
char *str; char *str;
//GTlsCertificate *cert; //GTlsCertificate *cert;

View File

@@ -1,8 +1,9 @@
#ifndef __TELEPORT_SERVER_H #ifndef __TELEPORT_SERVER_H
#define __TELEPORT_SERVER_H #define __TELEPORT_SERVER_H
int teleport_server_run (void);
extern int run_http_server(void); int teleport_server_add_route (gchar *,
extern int addRouteToServer(char *, char *, char *); gchar *,
gchar *);
#endif /* __TELEPORT_SERVER_H */ #endif /* __TELEPORT_SERVER_H */

View File

@@ -78,7 +78,7 @@ open_file_picker(GtkButton *btn, Peer *device) {
filename = gtk_file_chooser_get_filename (chooser); filename = gtk_file_chooser_get_filename (chooser);
g_print("Choosen file is %s\n", filename); g_print("Choosen file is %s\n", filename);
gtk_widget_destroy (dialog); gtk_widget_destroy (dialog);
addRouteToServer(g_compute_checksum_for_string (G_CHECKSUM_SHA256, filename, -1), filename, device->ip); teleport_server_add_route (g_compute_checksum_for_string (G_CHECKSUM_SHA256, filename, -1), filename, device->ip);
g_free (filename); g_free (filename);
} }
else else