From dc888b9e42f33aed89c81f1e98a251b34a69168a Mon Sep 17 00:00:00 2001 From: Jakub Adam Date: Tue, 2 Aug 2016 07:41:36 +0200 Subject: [PATCH] appshare: add RDP client choice --- src/api/sipe-backend.h | 7 +++++ src/core/sipe-appshare.c | 11 +++++++- src/purple/Makefile.am | 6 ++++ src/purple/purple-appshare.c | 58 +++++++++++++++++++++++++++++++++++++++ src/purple/purple-plugin-common.c | 9 +++++- 5 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 src/purple/purple-appshare.c diff --git a/src/api/sipe-backend.h b/src/api/sipe-backend.h index 7cad2492..bcbd13d1 100644 --- a/src/api/sipe-backend.h +++ b/src/api/sipe-backend.h @@ -377,6 +377,11 @@ typedef enum { SIPE_ENCRYPTION_POLICY_OBEY_SERVER } SipeEncryptionPolicy; +typedef enum { + SIPE_RDP_CLIENT_REMMINA, + SIPE_RDP_CLIENT_XFREERDP +} SipeRDPClient; + struct sipe_media_call; struct sipe_backend_media; struct sipe_backend_codec; @@ -1088,6 +1093,8 @@ struct sipe_backend_buddy_menu *sipe_backend_buddy_sub_menu_add(struct sipe_core SipeEncryptionPolicy sipe_backend_media_get_encryption_policy(struct sipe_core_public *sipe_public); +SipeRDPClient sipe_backend_appshare_get_rdp_client(struct sipe_core_public *sipe_public); + #ifdef __cplusplus } #endif diff --git a/src/core/sipe-appshare.c b/src/core/sipe-appshare.c index 6836f904..6dba633a 100644 --- a/src/core/sipe-appshare.c +++ b/src/core/sipe-appshare.c @@ -27,10 +27,12 @@ #include "sipmsg.h" #include "sipe-appshare.h" #include "sipe-appshare-xfreerdp.h" +#include "sipe-appshare-remmina.h" #include "sipe-backend.h" #include "sipe-buddy.h" #include "sipe-common.h" #include "sipe-core.h" +#include "sipe-core-private.h" #include "sipe-media.h" #include "sipe-nls.h" #include "sipe-schedule.h" @@ -447,7 +449,14 @@ process_incoming_invite_appshare(struct sipe_core_private *sipe_private, appshare = g_new0(struct sipe_appshare, 1); appshare->stream = stream; - sipe_appshare_xfreerdp_init(&appshare->client); + + switch (sipe_backend_appshare_get_rdp_client(SIPE_CORE_PUBLIC)) { + case SIPE_RDP_CLIENT_REMMINA: + sipe_appshare_remmina_init(&appshare->client); + break; + default: + sipe_appshare_xfreerdp_init(&appshare->client); + } sipe_media_stream_set_data(stream, appshare, (GDestroyNotify)sipe_appshare_free); diff --git a/src/purple/Makefile.am b/src/purple/Makefile.am index 79c84d0e..46d7cc86 100644 --- a/src/purple/Makefile.am +++ b/src/purple/Makefile.am @@ -127,6 +127,12 @@ libsipe_la_LIBADD += \ $(NICE_LIBS) \ $(GSTREAMER_LIBS) \ $(FARSTREAM_LIBS) + +if SIPE_HAVE_XDATA +if SIPE_HAVE_GIO +libsipe_backend_la_SOURCES += purple-appshare.c +endif +endif endif TESTS = $(check_PROGRAMS) diff --git a/src/purple/purple-appshare.c b/src/purple/purple-appshare.c new file mode 100644 index 00000000..9a0e2a4f --- /dev/null +++ b/src/purple/purple-appshare.c @@ -0,0 +1,58 @@ +/** + * @file purple-appshare.c + * + * pidgin-sipe + * + * Copyright (C) 2016 SIPE Project + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include + +#include "sipe-backend.h" +#include "sipe-core.h" +#include "purple-private.h" + +SipeRDPClient +sipe_backend_appshare_get_rdp_client(struct sipe_core_public *sipe_public) +{ + PurpleAccount *account; + const char *client; + + account = sipe_public->backend_private->account; + + client = purple_account_get_string(account, "rdp-client", "remmina"); + if (sipe_strequal(client, "remmina")) { + return SIPE_RDP_CLIENT_REMMINA; + } else { + return SIPE_RDP_CLIENT_XFREERDP; + } +} + +/* + Local Variables: + mode: c + c-file-style: "bsd" + indent-tabs-mode: t + tab-width: 8 + End: +*/ diff --git a/src/purple/purple-plugin-common.c b/src/purple/purple-plugin-common.c index fb149742..df0324ef 100644 --- a/src/purple/purple-plugin-common.c +++ b/src/purple/purple-plugin-common.c @@ -3,7 +3,7 @@ * * pidgin-sipe * - * Copyright (C) 2010-2015 SIPE Project + * Copyright (C) 2010-2016 SIPE Project * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -929,6 +929,13 @@ GList * sipe_purple_account_options() option = purple_account_option_string_new(_("Group Chat Proxy\n company.com or user@company.com\n(leave empty to determine from Username)"), "groupchat_user", ""); options = g_list_append(options, option); +#if defined(HAVE_XDATA) && defined(HAVE_GIO) + option = purple_account_option_list_new(_("Remote desktop client"), "rdp-client", NULL); + purple_account_option_add_list_item(option, "Remmina", "remmina"); + purple_account_option_add_list_item(option, "xfreerdp", "xfreerdp"); + options = g_list_append(options, option); +#endif + #ifdef HAVE_SRTP option = purple_account_option_list_new(_("Media encryption"), "encryption-policy", NULL); purple_account_option_add_list_item(option, _("Obey server policy"), "obey-server"); -- 2.11.4.GIT