Commit 01453a37 authored by Antenore Gatta's avatar Antenore Gatta

Code beautyfied

parent bf34393e
......@@ -44,10 +44,11 @@ static RemminaPluginService *remmina_plugin_service = NULL;
static SecretSchema remmina_file_secret_schema =
{ "org.remmina.Password", SECRET_SCHEMA_NONE,
{
{ "filename", SECRET_SCHEMA_ATTRIBUTE_STRING },
{ "key", SECRET_SCHEMA_ATTRIBUTE_STRING },
{ NULL, 0 } } };
{
{ "filename", SECRET_SCHEMA_ATTRIBUTE_STRING },
{ "key", SECRET_SCHEMA_ATTRIBUTE_STRING },
{ NULL, 0 }
} };
#ifdef LIBSECRET_VERSION_0_18
......@@ -65,10 +66,8 @@ static void remmina_plugin_glibsecret_unlock_secret_service()
GList *objects, *ul;
gchar* lbl;
if (secretservice && defaultcollection)
{
if (secret_collection_get_locked(defaultcollection))
{
if (secretservice && defaultcollection) {
if (secret_collection_get_locked(defaultcollection)) {
lbl = secret_collection_get_label(defaultcollection);
remmina_plugin_service->log_printf("[glibsecret] requesting unlock of the default '%s' collection\n", lbl);
objects = g_list_append(NULL, defaultcollection);
......@@ -95,14 +94,11 @@ void remmina_plugin_glibsecret_store_password(RemminaFile *remminafile, const gc
secret_password_store_sync(&remmina_file_secret_schema, SECRET_COLLECTION_DEFAULT, s, password,
NULL, &r, "filename", path, "key", key, NULL);
g_free(s);
if (r == NULL)
{
if (r == NULL) {
remmina_plugin_service->log_printf("[glibsecret] password saved for file %s\n", path);
}
else
{
}else {
remmina_plugin_service->log_printf("[glibsecret] password cannot be saved for file %s\n", path);
g_error_free (r);
g_error_free(r);
}
}
......@@ -119,15 +115,12 @@ remmina_plugin_glibsecret_get_password(RemminaFile *remminafile, const gchar *ke
path = remmina_plugin_service->file_get_path(remminafile);
password = secret_password_lookup_sync(&remmina_file_secret_schema, NULL, &r, "filename", path, "key", key, NULL);
if (r == NULL)
{
if (r == NULL) {
remmina_plugin_service->log_printf("[glibsecret] found password for file %s\n", path);
p = g_strdup(password);
secret_password_free(password);
return p;
}
else
{
}else {
remmina_plugin_service->log_printf("[glibsecret] password cannot be found for file %s\n", path);
return NULL;
}
......@@ -143,12 +136,9 @@ void remmina_plugin_glibsecret_delete_password(RemminaFile *remminafile, const g
path = remmina_plugin_service->file_get_path(remminafile);
secret_password_clear_sync(&remmina_file_secret_schema, NULL, &r, "filename", path, "key", key, NULL);
if (r == NULL)
{
if (r == NULL) {
remmina_plugin_service->log_printf("[glibsecret] password deleted for file %s\n", path);
}
else
{
}else {
remmina_plugin_service->log_printf("[glibsecret] password cannot be deleted for file %s\n", path);
}
}
......@@ -156,7 +146,7 @@ void remmina_plugin_glibsecret_delete_password(RemminaFile *remminafile, const g
static RemminaSecretPlugin remmina_plugin_glibsecret =
{ REMMINA_PLUGIN_TYPE_SECRET, "glibsecret", "GNOME libsecret", NULL, VERSION,
TRUE, remmina_plugin_glibsecret_store_password, remmina_plugin_glibsecret_get_password, remmina_plugin_glibsecret_delete_password };
TRUE, remmina_plugin_glibsecret_store_password, remmina_plugin_glibsecret_get_password, remmina_plugin_glibsecret_delete_password };
G_MODULE_EXPORT gboolean
remmina_plugin_entry(RemminaPluginService *service)
......@@ -165,8 +155,7 @@ remmina_plugin_entry(RemminaPluginService *service)
remmina_plugin_service = service;
if (!service->register_plugin((RemminaPlugin *) &remmina_plugin_glibsecret))
{
if (!service->register_plugin((RemminaPlugin*)&remmina_plugin_glibsecret)) {
return FALSE;
}
......
......@@ -71,8 +71,8 @@ typedef void (*PThreadCleanupFunc)(void*);
#define IDLE_ADD gdk_threads_add_idle
#define TIMEOUT_ADD gdk_threads_add_timeout
#define CANCEL_ASYNC pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,NULL);pthread_testcancel();
#define CANCEL_DEFER pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED,NULL);
#define CANCEL_ASYNC pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); pthread_testcancel();
#define CANCEL_DEFER pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
#define THREADS_ENTER _Pragma("GCC error \"THREADS_ENTER has been deprecated in Remmina 1.2\"")
#define THREADS_LEAVE _Pragma("GCC error \"THREADS_LEAVE has been deprecated in Remmina 1.2\"")
......@@ -81,21 +81,21 @@ typedef void (*PThreadCleanupFunc)(void*);
#define X_UNIX_SOCKET "/tmp/.X11-unix/X%d"
#define INCLUDE_GET_AVAILABLE_XDISPLAY static gint \
remmina_get_available_xdisplay (void) \
{ \
remmina_get_available_xdisplay(void) \
{ \
gint i; \
gint display = 0; \
gchar fn[200]; \
for (i = 1; i < MAX_X_DISPLAY_NUMBER; i++) \
{ \
g_snprintf (fn, sizeof (fn), X_UNIX_SOCKET, i); \
if (!g_file_test (fn, G_FILE_TEST_EXISTS)) \
g_snprintf(fn, sizeof(fn), X_UNIX_SOCKET, i); \
if (!g_file_test(fn, G_FILE_TEST_EXISTS)) \
{ \
display = i; \
break; \
} \
} \
return display; \
}
}
This diff is collapsed.
......@@ -36,14 +36,13 @@
#pragma once
#define GET_PLUGIN_DATA(gp) (RemminaPluginNxData*) g_object_get_data(G_OBJECT(gp), "plugin-data");
#define GET_PLUGIN_DATA(gp) (RemminaPluginNxData*)g_object_get_data(G_OBJECT(gp), "plugin-data");
G_BEGIN_DECLS
#include "nx_session.h"
typedef enum
{
typedef enum {
REMMINA_NX_EVENT_CANCEL,
REMMINA_NX_EVENT_START,
REMMINA_NX_EVENT_RESTORE,
......@@ -51,8 +50,7 @@ typedef enum
REMMINA_NX_EVENT_TERMINATE
} RemminaNXEventType;
typedef struct _RemminaPluginNxData
{
typedef struct _RemminaPluginNxData {
GtkWidget *socket;
gint socket_id;
......
......@@ -208,9 +208,9 @@ static void remmina_nx_session_set_application_error(RemminaNXSession *nx, const
va_list args;
if (nx->error) g_free(nx->error);
va_start (args, fmt);
nx->error = g_strdup_vprintf (fmt, args);
va_end (args);
va_start(args, fmt);
nx->error = g_strdup_vprintf(fmt, args);
va_end(args);
}
gboolean remmina_nx_session_has_error(RemminaNXSession *nx)
......@@ -292,7 +292,7 @@ static gboolean remmina_nx_session_get_response(RemminaNXSession *nx)
}
if (len > 0) {
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
g_string_append_len(nx->response, (const gchar*) buffer_get(buffer), len);
g_string_append_len(nx->response, (const gchar*)buffer_get(buffer), len);
G_GNUC_END_IGNORE_DEPRECATIONS
}
......@@ -310,7 +310,7 @@ static void remmina_nx_session_parse_session_list_line(RemminaNXSession *nx, con
gint i;
GtkTreeIter iter;
p1 = (char*) line;
p1 = (char*)line;
while (*p1 == ' ')
p1++;
if (*p1 == '\0')
......@@ -318,7 +318,7 @@ static void remmina_nx_session_parse_session_list_line(RemminaNXSession *nx, con
gtk_list_store_append(nx->session_list, &iter);
p1 = (char*) line;
p1 = (char*)line;
for (i = 0; i < 7; i++) {
p2 = strchr(p1, ' ');
if (!p2)
......@@ -523,13 +523,13 @@ static void remmina_nx_session_send_command(RemminaNXSession *nx, const gchar *c
va_list args;
gchar *cmd;
va_start (args, cmdfmt);
cmd = g_strdup_vprintf (cmdfmt, args);
ssh_channel_write (nx->channel, cmd, strlen (cmd));
va_start(args, cmdfmt);
cmd = g_strdup_vprintf(cmdfmt, args);
ssh_channel_write(nx->channel, cmd, strlen(cmd));
g_free(cmd);
ssh_set_fd_towrite (nx->session);
ssh_channel_write (nx->channel, "\n", 1);
ssh_set_fd_towrite(nx->session);
ssh_channel_write(nx->channel, "\n", 1);
va_end(args);
}
......@@ -644,9 +644,9 @@ void remmina_nx_session_add_parameter(RemminaNXSession *nx, const gchar *name, c
va_list args;
gchar *value;
va_start (args, valuefmt);
value = g_strdup_vprintf (valuefmt, args);
g_hash_table_insert(nx->session_parameters, g_strdup (name), value);
va_start(args, valuefmt);
value = g_strdup_vprintf(valuefmt, args);
g_hash_table_insert(nx->session_parameters, g_strdup(name), value);
va_end(args);
}
......@@ -659,7 +659,7 @@ static gboolean remmina_nx_session_send_session_command(RemminaNXSession *nx, co
cmd = g_string_new(cmd_type);
g_hash_table_iter_init(&iter, nx->session_parameters);
while (g_hash_table_iter_next(&iter, (gpointer*) &key, (gpointer*) &value)) {
while (g_hash_table_iter_next(&iter, (gpointer*)&key, (gpointer*)&value)) {
g_string_append_printf(cmd, " --%s=\"%s\"", key, value);
}
......@@ -780,7 +780,7 @@ gboolean remmina_nx_session_terminate(RemminaNXSession *nx)
static gpointer remmina_nx_session_tunnel_main_thread(gpointer data)
{
TRACE_CALL("__func__");
RemminaNXSession *nx = (RemminaNXSession*) data;
RemminaNXSession *nx = (RemminaNXSession*)data;
gchar *ptr;
ssize_t len = 0, lenw = 0;
fd_set set;
......@@ -834,7 +834,7 @@ static gpointer remmina_nx_session_tunnel_main_thread(gpointer data)
for (ptr = buffer, lenw = 0; len > 0; len -= lenw, ptr += lenw) {
ssh_set_fd_towrite(nx->session);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
lenw = channel_write(channels[0], (char*) ptr, len);
lenw = channel_write(channels[0], (char*)ptr, len);
G_GNUC_END_IGNORE_DEPRECATIONS
if (lenw <= 0) {
nx->running = FALSE;
......@@ -923,7 +923,7 @@ gboolean remmina_nx_session_tunnel_open(RemminaNXSession *nx)
sin.sin_port = htons(port);
sin.sin_addr.s_addr = inet_addr("127.0.0.1");
if (bind(sock, (struct sockaddr *) &sin, sizeof(sin))) {
if (bind(sock, (struct sockaddr *)&sin, sizeof(sin))) {
remmina_nx_session_set_application_error(nx, "Failed to bind on local port.");
close(sock);
return FALSE;
......@@ -952,11 +952,11 @@ remmina_nx_session_get_proxy_option(RemminaNXSession *nx)
TRACE_CALL("__func__");
if (nx->encryption) {
return g_strdup_printf("nx,session=%s,cookie=%s,id=%s,shmem=1,shpix=1,connect=127.0.0.1:%i",
(gchar*) g_hash_table_lookup(nx->session_parameters, "session"), nx->proxy_cookie,
(gchar*)g_hash_table_lookup(nx->session_parameters, "session"), nx->proxy_cookie,
nx->session_id, (nx->localport ? nx->localport : nx->session_display));
} else {
return g_strdup_printf("nx,session=%s,cookie=%s,id=%s,shmem=1,shpix=1,connect=%s:%i",
(gchar*) g_hash_table_lookup(nx->session_parameters, "session"), nx->proxy_cookie,
(gchar*)g_hash_table_lookup(nx->session_parameters, "session"), nx->proxy_cookie,
nx->session_id, nx->server, nx->session_display);
}
}
......
......@@ -37,8 +37,7 @@
G_BEGIN_DECLS
enum
{
enum {
REMMINA_NX_SESSION_COLUMN_DISPLAY,
REMMINA_NX_SESSION_COLUMN_TYPE,
REMMINA_NX_SESSION_COLUMN_ID,
......
......@@ -44,13 +44,10 @@ static void remmina_nx_session_manager_set_sensitive(RemminaProtocolWidget *gp,
TRACE_CALL("__func__");
RemminaPluginNxData *gpdata = GET_PLUGIN_DATA(gp);
if (gpdata->attach_session)
{
if (gpdata->attach_session) {
gtk_dialog_set_response_sensitive(GTK_DIALOG(gpdata->manager_dialog), REMMINA_NX_EVENT_TERMINATE, sensitive);
gtk_dialog_set_response_sensitive(GTK_DIALOG(gpdata->manager_dialog), REMMINA_NX_EVENT_ATTACH, sensitive);
}
else
{
}else {
gtk_dialog_set_response_sensitive(GTK_DIALOG(gpdata->manager_dialog), REMMINA_NX_EVENT_TERMINATE, sensitive);
gtk_dialog_set_response_sensitive(GTK_DIALOG(gpdata->manager_dialog), REMMINA_NX_EVENT_RESTORE, sensitive);
}
......@@ -60,12 +57,11 @@ static gboolean remmina_nx_session_manager_selection_func(GtkTreeSelection *sele
gboolean path_currently_selected, gpointer user_data)
{
TRACE_CALL("__func__");
RemminaProtocolWidget *gp = (RemminaProtocolWidget*) user_data;
RemminaProtocolWidget *gp = (RemminaProtocolWidget*)user_data;
RemminaPluginNxData *gpdata = GET_PLUGIN_DATA(gp);
gpdata->manager_selected = FALSE;
if (path_currently_selected)
{
if (path_currently_selected) {
remmina_nx_session_manager_set_sensitive(gp, FALSE);
return TRUE;
}
......@@ -80,10 +76,9 @@ static gboolean remmina_nx_session_manager_selection_func(GtkTreeSelection *sele
static void remmina_nx_session_manager_send_signal(RemminaPluginNxData *gpdata, gint event_type)
{
TRACE_CALL("__func__");
guchar dummy = (guchar) event_type;
guchar dummy = (guchar)event_type;
/* Signal the NX thread to resume execution */
if (write(gpdata->event_pipe[1], &dummy, 1))
{
if (write(gpdata->event_pipe[1], &dummy, 1)) {
}
}
......@@ -94,25 +89,19 @@ static void remmina_nx_session_manager_on_response(GtkWidget *dialog, gint respo
gint event_type;
remmina_nx_session_manager_set_sensitive(gp, FALSE);
if (response_id <= 0)
{
if (response_id <= 0) {
event_type = REMMINA_NX_EVENT_CANCEL;
}
else
{
}else {
event_type = response_id;
}
if (response_id == REMMINA_NX_EVENT_TERMINATE && gpdata->manager_selected)
{
if (response_id == REMMINA_NX_EVENT_TERMINATE && gpdata->manager_selected) {
remmina_nx_session_iter_set(gpdata->nx, &gpdata->iter, REMMINA_NX_SESSION_COLUMN_STATUS, _("Terminating"));
}
if (response_id != REMMINA_NX_EVENT_TERMINATE)
{
if (response_id != REMMINA_NX_EVENT_TERMINATE) {
gtk_widget_destroy(dialog);
gpdata->manager_dialog = NULL;
}
if (response_id != REMMINA_NX_EVENT_TERMINATE && response_id != REMMINA_NX_EVENT_CANCEL)
{
if (response_id != REMMINA_NX_EVENT_TERMINATE && response_id != REMMINA_NX_EVENT_CANCEL) {
remmina_plugin_nx_service->protocol_plugin_init_show(gp);
}
remmina_nx_session_manager_send_signal(gpdata, event_type);
......@@ -127,8 +116,7 @@ void remmina_nx_session_manager_on_row_activated(GtkTreeView *tree, GtkTreePath
remmina_plugin_nx_service->log_printf("[NX] Default response_id %d\n",
gpdata->default_response);
if (gpdata->default_response >= 0)
{
if (gpdata->default_response >= 0) {
gtk_dialog_response(GTK_DIALOG(gpdata->manager_dialog), gpdata->default_response);
}
}
......@@ -148,22 +136,18 @@ static gboolean remmina_nx_session_manager_main(RemminaProtocolWidget *gp)
remminafile = remmina_plugin_nx_service->protocol_plugin_get_file(gp);
gpdata->default_response = -1;
if (!gpdata->manager_started)
{
if (!gpdata->manager_started) {
remmina_plugin_nx_service->protocol_plugin_init_hide(gp);
dialog = gtk_dialog_new();
s = g_strdup_printf(_("NX Sessions on %s"), remmina_plugin_nx_service->file_get_string(remminafile, "server"));
gtk_window_set_title(GTK_WINDOW(dialog), s);
g_free(s);
if (gpdata->attach_session)
{
if (gpdata->attach_session) {
gtk_dialog_add_button(GTK_DIALOG(dialog), _("Attach"), REMMINA_NX_EVENT_ATTACH);
/* Set default response id for attach */
gpdata->default_response = REMMINA_NX_EVENT_ATTACH;
}
else
{
}else {
gtk_dialog_add_button(GTK_DIALOG(dialog), _("Restore"), REMMINA_NX_EVENT_RESTORE);
gtk_dialog_add_button(GTK_DIALOG(dialog), _("Start"), REMMINA_NX_EVENT_START);
/* Set default response id for restore */
......@@ -230,20 +214,18 @@ static gboolean remmina_nx_session_manager_main(RemminaProtocolWidget *gp)
gpdata->manager_started = TRUE;
}
gpdata->manager_selected = FALSE;
if (gpdata->manager_dialog)
{
if (gpdata->manager_dialog) {
remmina_nx_session_manager_set_sensitive(gp, FALSE);
gtk_widget_show(gpdata->manager_dialog);
}
if (remmina_nx_session_has_error(gpdata->nx))
{
if (remmina_nx_session_has_error(gpdata->nx)) {
dialog = gtk_message_dialog_new((gpdata->manager_dialog ? GTK_WINDOW(gpdata->manager_dialog) : NULL),
GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s",
remmina_nx_session_get_error (gpdata->nx));
remmina_nx_session_clear_error (gpdata->nx);
gtk_dialog_run (GTK_DIALOG(dialog));
gtk_widget_destroy (dialog);
remmina_nx_session_manager_send_signal (gpdata, 0);
remmina_nx_session_get_error(gpdata->nx));
remmina_nx_session_clear_error(gpdata->nx);
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
remmina_nx_session_manager_send_signal(gpdata, 0);
}
gpdata->session_manager_start_handler = 0;
......@@ -255,9 +237,8 @@ void remmina_nx_session_manager_start(RemminaProtocolWidget *gp)
TRACE_CALL("__func__");
RemminaPluginNxData *gpdata = GET_PLUGIN_DATA(gp);
if (gpdata->session_manager_start_handler == 0)
{
gpdata->session_manager_start_handler = IDLE_ADD((GSourceFunc) remmina_nx_session_manager_main, gp);
if (gpdata->session_manager_start_handler == 0) {
gpdata->session_manager_start_handler = IDLE_ADD((GSourceFunc)remmina_nx_session_manager_main, gp);
}
}
......@@ -43,20 +43,15 @@
void remmina_rdp_OnChannelConnectedEventHandler(rdpContext* context, ChannelConnectedEventArgs* e)
{
rfContext* rfi = (rfContext*) context;
rfContext* rfi = (rfContext*)context;
if (g_strcmp0(e->name, RDPEI_DVC_CHANNEL_NAME) == 0)
{
if (g_strcmp0(e->name, RDPEI_DVC_CHANNEL_NAME) == 0) {
g_print("Unimplemented: channel %s connected but we can't use it\n", e->name);
// xfc->rdpei = (RdpeiClientContext*) e->pInterface;
}
else if (g_strcmp0(e->name, TSMF_DVC_CHANNEL_NAME) == 0)
{
}else if (g_strcmp0(e->name, TSMF_DVC_CHANNEL_NAME) == 0) {
g_print("Unimplemented: channel %s connected but we can't use it\n", e->name);
// xf_tsmf_init(xfc, (TsmfClientContext*) e->pInterface);
}
else if (g_strcmp0(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
{
}else if (g_strcmp0(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0) {
g_print("Unimplemented: channel %s connected but we can't use it\n", e->name);
/*
if (settings->SoftwareGdi)
......@@ -64,23 +59,15 @@ void remmina_rdp_OnChannelConnectedEventHandler(rdpContext* context, ChannelConn
else
xf_graphics_pipeline_init(xfc, (RdpgfxClientContext*) e->pInterface);
*/
}
else if (g_strcmp0(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
{
}else if (g_strcmp0(e->name, RAIL_SVC_CHANNEL_NAME) == 0) {
g_print("Unimplemented: channel %s connected but we can't use it\n", e->name);
// xf_rail_init(xfc, (RailClientContext*) e->pInterface);
}
else if (g_strcmp0(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
{
remmina_rdp_cliprdr_init( rfi, (CliprdrClientContext*) e->pInterface);
}
else if (g_strcmp0(e->name, ENCOMSP_SVC_CHANNEL_NAME) == 0)
{
}else if (g_strcmp0(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0) {
remmina_rdp_cliprdr_init( rfi, (CliprdrClientContext*)e->pInterface);
}else if (g_strcmp0(e->name, ENCOMSP_SVC_CHANNEL_NAME) == 0) {
g_print("Unimplemented: channel %s connected but we can't use it\n", e->name);
// xf_encomsp_init(xfc, (EncomspClientContext*) e->pInterface);
}
else if (g_strcmp0(e->name, DISP_DVC_CHANNEL_NAME) == 0)
{
}else if (g_strcmp0(e->name, DISP_DVC_CHANNEL_NAME) == 0) {
// "disp" channel connected, save its context pointer
rfi->dispcontext = (DispClientContext*)e->pInterface;
// Notify remmina_connection_window to unlock dynres capability
......
This diff is collapsed.
This diff is collapsed.
......@@ -62,30 +62,18 @@ gboolean remmina_rdp_file_import_test(const gchar* from_file)
static void remmina_rdp_file_import_field(RemminaFile* remminafile, const gchar* key, const gchar* value)
{
TRACE_CALL("__func__");
if (g_strcmp0(key, "desktopwidth") == 0)
{
if (g_strcmp0(key, "desktopwidth") == 0) {
remmina_plugin_service->file_set_string(remminafile, "resolution_width", value);
}
else if (g_strcmp0(key, "desktopheight") == 0)
{
}else if (g_strcmp0(key, "desktopheight") == 0) {
remmina_plugin_service->file_set_string(remminafile, "resolution_height", value);
}
else if (g_strcmp0(key, "session bpp") == 0)
{
}else if (g_strcmp0(key, "session bpp") == 0) {
remmina_plugin_service->file_set_string(remminafile, "colordepth", value);
}
else if (g_strcmp0(key, "keyboardhook") == 0)
{
remmina_plugin_service->file_set_int(remminafile, "keyboard_grab", (atoi (value) == 1));
}
else if (g_strcmp0(key, "full address") == 0)
{
}else if (g_strcmp0(key, "keyboardhook") == 0) {
remmina_plugin_service->file_set_int(remminafile, "keyboard_grab", (atoi(value) == 1));
}else if (g_strcmp0(key, "full address") == 0) {
remmina_plugin_service->file_set_string(remminafile, "server", value);
}
else if (g_strcmp0(key, "audiomode") == 0)
{
switch (atoi(value))
{
}else if (g_strcmp0(key, "audiomode") == 0) {
switch (atoi(value)) {
case 0:
remmina_plugin_service->file_set_string(remminafile, "sound", "local");
break;
......@@ -93,66 +81,37 @@ static void remmina_rdp_file_import_field(RemminaFile* remminafile, const gchar*
remmina_plugin_service->file_set_string(remminafile, "sound", "remote");
break;
}
}
else if (g_strcmp0(key, "microphone") == 0)
{
remmina_plugin_service->file_set_int(remminafile, "microphone", (atoi (value) == 1));
}
else if (g_strcmp0(key, "redirectprinters") == 0)
{
remmina_plugin_service->file_set_int(remminafile, "shareprinter", (atoi (value) == 1));
}
else if (g_strcmp0(key, "redirectsmartcard") == 0)
{
remmina_plugin_service->file_set_int(remminafile, "sharesmartcard", (atoi (value) == 1));
}
else if (g_strcmp0(key, "redirectclipboard") == 0)
{
remmina_plugin_service->file_set_int(remminafile, "disableclipboard", (atoi (value) != 1));
}
else if (g_strcmp0(key, "alternate shell") == 0)
{
}else if (g_strcmp0(key, "microphone") == 0) {
remmina_plugin_service->file_set_int(remminafile, "microphone", (atoi(value) == 1));
} else if (g_strcmp0(key, "redirectprinters") == 0) {
remmina_plugin_service->file_set_int(remminafile, "shareprinter", (atoi(value) == 1));
}else if (g_strcmp0(key, "redirectsmartcard") == 0) {
remmina_plugin_service->file_set_int(remminafile, "sharesmartcard", (atoi(value) == 1));
}else if (g_strcmp0(key, "redirectclipboard") == 0) {
remmina_plugin_service->file_set_int(remminafile, "disableclipboard", (atoi(value) != 1));
}else if (g_strcmp0(key, "alternate shell") == 0) {
remmina_plugin_service->file_set_string(remminafile, "exec", value);
}
else if (g_strcmp0(key, "shell working directory") == 0)
{
}else if (g_strcmp0(key, "shell working directory") == 0) {
remmina_plugin_service->file_set_string(remminafile, "execpath", value);
}
else if (g_strcmp0(key, "loadbalanceinfo") == 0)
{
}else if (g_strcmp0(key, "loadbalanceinfo") == 0) {
remmina_plugin_service->file_set_string(remminafile, "loadbalanceinfo", value);
}
else if (g_strcmp0(key, "gatewayhostname") == 0)
{
}else if (g_strcmp0(key, "gatewayhostname") == 0) {
remmina_plugin_service->file_set_string(remminafile, "gateway_server", value);
}
else if (g_strcmp0(key, "gatewayusagemethod") == 0)
{
}else if (g_strcmp0(key, "gatewayusagemethod") == 0) {
remmina_plugin_service->file_set_string(remminafile, "gatewayusagemethod", value);
}
else if (g_strcmp0(key, "gatewaycredentialssource") == 0)
{
}else if (g_strcmp0(key, "gatewaycredentialssource") == 0) {
remmina_plugin_service->file_set_string(remminafile, "gatewaycredentialssource", value);
}
else if (g_strcmp0(key, "gatewayprofileusagemethod") == 0)
{
}else if (g_strcmp0(key, "gatewayprofileusagemethod") == 0) {
remmina_plugin_service->file_set_string(remminafile, "gatewayprofileusagemethod", value);
}
/* tsclient fields, import only */
else if (g_strcmp0(key, "client hostname") == 0)
{
else if (g_strcmp0(key, "client hostname") == 0) {
remmina_plugin_service->file_set_string(remminafile, "clientname", value);
}
else if (g_strcmp0(key, "domain") == 0)
{
}else if (g_strcmp0(key, "domain") == 0) {
remmina_plugin_service->file_set_string(remminafile, "domain", value);
}
else if (g_strcmp0(key, "username") == 0)
{
}else if (g_strcmp0(key, "username") == 0) {
remmina_plugin_service->file_set_string(remminafile, "username", value);
}
else if (g_strcmp0(key, "password") == 0)
{
}else if (g_strcmp0(key, "password") == 0) {
remmina_plugin_service->file_set_string(remminafile, "password", value);
}
}
......@@ -168,60 +127,48 @@ static RemminaFile* remmina_rdp_file_import_channel(GIOChannel* channel)
RemminaFile* remminafile;
guchar magic[2] = { 0 };
if (g_io_channel_set_encoding(channel, NULL, &error) != G_IO_STATUS_NORMAL)
{
if (g_io_channel_set_encoding(channel, NULL, &error) != G_IO_STATUS_NORMAL) {
g_print("g_io_channel_set_encoding: %s\n", error->message);
return NULL;
}
/* Try to detect the UTF-16 encoding */
if (g_io_channel_read_chars(channel, (gchar*) magic, 2, &bytes_read, &error) != G_IO_STATUS_NORMAL)
{
if (g_io_channel_read_chars(channel, (gchar*)magic, 2, &bytes_read, &error) != G_IO_STATUS_NORMAL) {
g_print("g_io_channel_read_chars: %s\n", error->message);
return NULL;
}
if (magic[0] == 0xFF && magic[1] == 0xFE)
{
if (magic[0] == 0xFF && magic[1] == 0xFE) {
enc = "UTF-16LE";
}
else if (magic[0] == 0xFE && magic[1] == 0xFF)
{
}else if (magic[0] == 0xFE && magic[1] == 0xFF) {
enc = "UTF-16BE";
}
else
{
}else {
enc = "UTF-8";
if (g_io_channel_seek_position(channel, 0, G_SEEK_SET, &error) != G_IO_STATUS_NORMAL)
{
if (g_io_channel_seek_position(channel, 0, G_SEEK_SET, &error) != G_IO_STATUS_NORMAL) {
g_print("g_io_channel_seek: failed\n");
return NULL;
}
}
if (g_io_channel_set_encoding(channel, enc, &error) != G_IO_STATUS_NORMAL)
{
if (g_io_channel_set_encoding(channel, enc, &error) != G_IO_STATUS_NORMAL) {
g_print("g_io_channel_set_encoding: %s\n", error->message);
return NULL;
}
remminafile = remmina_plugin_service->file_new();