Imported Upstream version 0.6
Laurent Bigonville
12 years ago
0 | NEW in 0.6 | |
1 | ========== | |
2 | ||
3 | - Depend on glib 2.28 to use g_io_stream_splice_async() instead of local copy. | |
4 | ||
0 | 5 | NEW in 0.5 |
1 | 6 | ========== |
2 | 7 |
78 | 78 | /* Define to 1 if you have the ANSI C header files. */ |
79 | 79 | #undef STDC_HEADERS |
80 | 80 | |
81 | /* Define the tube service name */ | |
82 | #undef TUBE_SERVICE | |
83 | ||
81 | 84 | /* Define to 1 if the X Window System is missing or not being used. */ |
82 | 85 | #undef X_DISPLAY_MISSING |
0 | 0 | #! /bin/sh |
1 | 1 | # Guess values for system-dependent variables and create Makefiles. |
2 | # Generated by GNU Autoconf 2.67 for ssh-contact 0.5. | |
2 | # Generated by GNU Autoconf 2.67 for ssh-contact 0.6. | |
3 | 3 | # |
4 | 4 | # Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=Telepathy&component=ssh-contact>. |
5 | 5 | # |
705 | 705 | # Identity of this package. |
706 | 706 | PACKAGE_NAME='ssh-contact' |
707 | 707 | PACKAGE_TARNAME='ssh-contact' |
708 | PACKAGE_VERSION='0.5' | |
709 | PACKAGE_STRING='ssh-contact 0.5' | |
708 | PACKAGE_VERSION='0.6' | |
709 | PACKAGE_STRING='ssh-contact 0.6' | |
710 | 710 | PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=Telepathy&component=ssh-contact' |
711 | 711 | PACKAGE_URL='' |
712 | 712 | |
1500 | 1500 | # Omit some internal or obsolete options to make the list less imposing. |
1501 | 1501 | # This message is too long to be a string in the A/UX 3.1 sh. |
1502 | 1502 | cat <<_ACEOF |
1503 | \`configure' configures ssh-contact 0.5 to adapt to many kinds of systems. | |
1503 | \`configure' configures ssh-contact 0.6 to adapt to many kinds of systems. | |
1504 | 1504 | |
1505 | 1505 | Usage: $0 [OPTION]... [VAR=VALUE]... |
1506 | 1506 | |
1574 | 1574 | |
1575 | 1575 | if test -n "$ac_init_help"; then |
1576 | 1576 | case $ac_init_help in |
1577 | short | recursive ) echo "Configuration of ssh-contact 0.5:";; | |
1577 | short | recursive ) echo "Configuration of ssh-contact 0.6:";; | |
1578 | 1578 | esac |
1579 | 1579 | cat <<\_ACEOF |
1580 | 1580 | |
1698 | 1698 | test -n "$ac_init_help" && exit $ac_status |
1699 | 1699 | if $ac_init_version; then |
1700 | 1700 | cat <<\_ACEOF |
1701 | ssh-contact configure 0.5 | |
1701 | ssh-contact configure 0.6 | |
1702 | 1702 | generated by GNU Autoconf 2.67 |
1703 | 1703 | |
1704 | 1704 | Copyright (C) 2010 Free Software Foundation, Inc. |
2071 | 2071 | This file contains any messages produced by compilers while |
2072 | 2072 | running configure, to aid debugging if configure makes a mistake. |
2073 | 2073 | |
2074 | It was created by ssh-contact $as_me 0.5, which was | |
2074 | It was created by ssh-contact $as_me 0.6, which was | |
2075 | 2075 | generated by GNU Autoconf 2.67. Invocation command line was |
2076 | 2076 | |
2077 | 2077 | $ $0 $@ |
2918 | 2918 | |
2919 | 2919 | # Define the identity of the package. |
2920 | 2920 | PACKAGE='ssh-contact' |
2921 | VERSION='0.5' | |
2921 | VERSION='0.6' | |
2922 | 2922 | |
2923 | 2923 | |
2924 | 2924 | # Some tools Automake needs. |
12903 | 12903 | if test -n "$PKG_CONFIG" && \ |
12904 | 12904 | { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" |
12905 | 12905 | telepathy-glib >= 0.13.9 |
12906 | glib-2.0 >= 2.24 | |
12906 | glib-2.0 >= 2.28 | |
12907 | 12907 | gio-2.0 |
12908 | 12908 | \""; } >&5 |
12909 | 12909 | ($PKG_CONFIG --exists --print-errors " |
12910 | 12910 | telepathy-glib >= 0.13.9 |
12911 | glib-2.0 >= 2.24 | |
12911 | glib-2.0 >= 2.28 | |
12912 | 12912 | gio-2.0 |
12913 | 12913 | ") 2>&5 |
12914 | 12914 | ac_status=$? |
12916 | 12916 | test $ac_status = 0; }; then |
12917 | 12917 | pkg_cv_SSH_CONTACT_CFLAGS=`$PKG_CONFIG --cflags " |
12918 | 12918 | telepathy-glib >= 0.13.9 |
12919 | glib-2.0 >= 2.24 | |
12919 | glib-2.0 >= 2.28 | |
12920 | 12920 | gio-2.0 |
12921 | 12921 | " 2>/dev/null` |
12922 | 12922 | else |
12931 | 12931 | if test -n "$PKG_CONFIG" && \ |
12932 | 12932 | { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" |
12933 | 12933 | telepathy-glib >= 0.13.9 |
12934 | glib-2.0 >= 2.24 | |
12934 | glib-2.0 >= 2.28 | |
12935 | 12935 | gio-2.0 |
12936 | 12936 | \""; } >&5 |
12937 | 12937 | ($PKG_CONFIG --exists --print-errors " |
12938 | 12938 | telepathy-glib >= 0.13.9 |
12939 | glib-2.0 >= 2.24 | |
12939 | glib-2.0 >= 2.28 | |
12940 | 12940 | gio-2.0 |
12941 | 12941 | ") 2>&5 |
12942 | 12942 | ac_status=$? |
12944 | 12944 | test $ac_status = 0; }; then |
12945 | 12945 | pkg_cv_SSH_CONTACT_LIBS=`$PKG_CONFIG --libs " |
12946 | 12946 | telepathy-glib >= 0.13.9 |
12947 | glib-2.0 >= 2.24 | |
12947 | glib-2.0 >= 2.28 | |
12948 | 12948 | gio-2.0 |
12949 | 12949 | " 2>/dev/null` |
12950 | 12950 | else |
12968 | 12968 | if test $_pkg_short_errors_supported = yes; then |
12969 | 12969 | SSH_CONTACT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors " |
12970 | 12970 | telepathy-glib >= 0.13.9 |
12971 | glib-2.0 >= 2.24 | |
12971 | glib-2.0 >= 2.28 | |
12972 | 12972 | gio-2.0 |
12973 | 12973 | " 2>&1` |
12974 | 12974 | else |
12975 | 12975 | SSH_CONTACT_PKG_ERRORS=`$PKG_CONFIG --print-errors " |
12976 | 12976 | telepathy-glib >= 0.13.9 |
12977 | glib-2.0 >= 2.24 | |
12977 | glib-2.0 >= 2.28 | |
12978 | 12978 | gio-2.0 |
12979 | 12979 | " 2>&1` |
12980 | 12980 | fi |
12983 | 12983 | |
12984 | 12984 | as_fn_error $? "Package requirements ( |
12985 | 12985 | telepathy-glib >= 0.13.9 |
12986 | glib-2.0 >= 2.24 | |
12986 | glib-2.0 >= 2.28 | |
12987 | 12987 | gio-2.0 |
12988 | 12988 | ) were not met: |
12989 | 12989 | |
14207 | 14207 | |
14208 | 14208 | |
14209 | 14209 | # ----------------------------------------------------------- |
14210 | ||
14211 | ||
14212 | $as_echo "#define TUBE_SERVICE \"x-ssh-contact\"" >>confdefs.h | |
14213 | ||
14210 | 14214 | |
14211 | 14215 | ac_config_files="$ac_config_files Makefile po/Makefile.in src/Makefile src/vinagre/Makefile" |
14212 | 14216 | |
14748 | 14752 | # report actual input values of CONFIG_FILES etc. instead of their |
14749 | 14753 | # values after options handling. |
14750 | 14754 | ac_log=" |
14751 | This file was extended by ssh-contact $as_me 0.5, which was | |
14755 | This file was extended by ssh-contact $as_me 0.6, which was | |
14752 | 14756 | generated by GNU Autoconf 2.67. Invocation command line was |
14753 | 14757 | |
14754 | 14758 | CONFIG_FILES = $CONFIG_FILES |
14814 | 14818 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 |
14815 | 14819 | ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" |
14816 | 14820 | ac_cs_version="\\ |
14817 | ssh-contact config.status 0.5 | |
14821 | ssh-contact config.status 0.6 | |
14818 | 14822 | configured by $0, generated by GNU Autoconf 2.67, |
14819 | 14823 | with options \\"\$ac_cs_config\\" |
14820 | 14824 |
0 | 0 | m4_define(released, 1) |
1 | AC_INIT(ssh-contact, 0.5, https://bugs.freedesktop.org/enter_bug.cgi?product=Telepathy&component=ssh-contact) | |
1 | AC_INIT(ssh-contact, 0.6, https://bugs.freedesktop.org/enter_bug.cgi?product=Telepathy&component=ssh-contact) | |
2 | 2 | AC_PREREQ(2.59) |
3 | 3 | AC_COPYRIGHT([ |
4 | 4 | Copyright (C) 2010 Collabora Ltd. |
27 | 27 | PKG_CHECK_MODULES(SSH_CONTACT, |
28 | 28 | [ |
29 | 29 | telepathy-glib >= 0.13.9 |
30 | glib-2.0 >= 2.24 | |
30 | glib-2.0 >= 2.28 | |
31 | 31 | gio-2.0 |
32 | 32 | ]) |
33 | 33 | |
109 | 109 | |
110 | 110 | # ----------------------------------------------------------- |
111 | 111 | |
112 | AC_DEFINE(TUBE_SERVICE, "x-ssh-contact", [Define the tube service name]) | |
113 | ||
112 | 114 | AC_OUTPUT([ |
113 | 115 | Makefile |
114 | 116 | po/Makefile.in |
64 | 64 | # compiler: $LTCC |
65 | 65 | # compiler flags: $LTCFLAGS |
66 | 66 | # linker: $LD (gnu? $with_gnu_ld) |
67 | # $progname: (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1 | |
67 | # $progname: (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu3 | |
68 | 68 | # automake: $automake_version |
69 | 69 | # autoconf: $autoconf_version |
70 | 70 | # |
72 | 72 | |
73 | 73 | PROGRAM=ltmain.sh |
74 | 74 | PACKAGE=libtool |
75 | VERSION="2.2.6b Debian-2.2.6b-2ubuntu1" | |
75 | VERSION="2.2.6b Debian-2.2.6b-2ubuntu3" | |
76 | 76 | TIMESTAMP="" |
77 | 77 | package_revision=1.3017 |
78 | 78 |
14 | 14 | libexec_PROGRAMS = ssh-contact-service |
15 | 15 | |
16 | 16 | ssh_contact_SOURCES = \ |
17 | common.c common.h \ | |
18 | 17 | client-helpers.c client-helpers.h \ |
19 | 18 | client.c |
20 | 19 | |
21 | 20 | ssh_contact_service_SOURCES = \ |
22 | common.c common.h \ | |
23 | 21 | service.c |
24 | 22 | |
25 | 23 | servicefiledir = $(datadir)/dbus-1/services |
52 | 52 | am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libexecdir)" \ |
53 | 53 | "$(DESTDIR)$(clientfiledir)" "$(DESTDIR)$(servicefiledir)" |
54 | 54 | PROGRAMS = $(bin_PROGRAMS) $(libexec_PROGRAMS) |
55 | am_ssh_contact_OBJECTS = common.$(OBJEXT) client-helpers.$(OBJEXT) \ | |
56 | client.$(OBJEXT) | |
55 | am_ssh_contact_OBJECTS = client-helpers.$(OBJEXT) client.$(OBJEXT) | |
57 | 56 | ssh_contact_OBJECTS = $(am_ssh_contact_OBJECTS) |
58 | 57 | ssh_contact_LDADD = $(LDADD) |
59 | 58 | am__DEPENDENCIES_1 = |
61 | 60 | AM_V_lt = $(am__v_lt_$(V)) |
62 | 61 | am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) |
63 | 62 | am__v_lt_0 = --silent |
64 | am_ssh_contact_service_OBJECTS = common.$(OBJEXT) service.$(OBJEXT) | |
63 | am_ssh_contact_service_OBJECTS = service.$(OBJEXT) | |
65 | 64 | ssh_contact_service_OBJECTS = $(am_ssh_contact_service_OBJECTS) |
66 | 65 | ssh_contact_service_LDADD = $(LDADD) |
67 | 66 | ssh_contact_service_DEPENDENCIES = $(am__DEPENDENCIES_1) |
321 | 320 | $(NULL) |
322 | 321 | |
323 | 322 | ssh_contact_SOURCES = \ |
324 | common.c common.h \ | |
325 | 323 | client-helpers.c client-helpers.h \ |
326 | 324 | client.c |
327 | 325 | |
328 | 326 | ssh_contact_service_SOURCES = \ |
329 | common.c common.h \ | |
330 | 327 | service.c |
331 | 328 | |
332 | 329 | servicefiledir = $(datadir)/dbus-1/services |
482 | 479 | |
483 | 480 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/client-helpers.Po@am__quote@ |
484 | 481 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/client.Po@am__quote@ |
485 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@ | |
486 | 482 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/service.Po@am__quote@ |
487 | 483 | |
488 | 484 | .c.o: |
20 | 20 | #include "config.h" |
21 | 21 | |
22 | 22 | #include "client-helpers.h" |
23 | #include "common.h" | |
24 | 23 | |
25 | 24 | typedef struct |
26 | 25 | { |
27 | 27 | #include <telepathy-glib/telepathy-glib.h> |
28 | 28 | |
29 | 29 | #include "client-helpers.h" |
30 | #include "common.h" | |
31 | 30 | |
32 | 31 | typedef struct |
33 | 32 | { |
107 | 106 | ClientContext *context = user_data; |
108 | 107 | GError *error = NULL; |
109 | 108 | |
110 | if (!_g_io_stream_splice_finish (res, &error)) | |
109 | if (!g_io_stream_splice_finish (res, &error)) | |
111 | 110 | throw_error (context, error); |
112 | 111 | else |
113 | 112 | leave (context); |
134 | 133 | } |
135 | 134 | |
136 | 135 | /* Splice tube and ssh connections */ |
137 | _g_io_stream_splice_async (G_IO_STREAM (context->tube_connection), | |
138 | G_IO_STREAM (context->ssh_connection), _G_IO_STREAM_SPLICE_NONE, | |
136 | g_io_stream_splice_async (G_IO_STREAM (context->tube_connection), | |
137 | G_IO_STREAM (context->ssh_connection), G_IO_STREAM_SPLICE_NONE, | |
139 | 138 | G_PRIORITY_DEFAULT, NULL, splice_cb, context); |
140 | 139 | } |
141 | 140 |
0 | /* | |
1 | * Copyright (C) 2010 Xavier Claessens <xclaesse@gmail.com> | |
2 | * Copyright (C) 2010 Collabora Ltd. | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or | |
5 | * modify it under the terms of the GNU General Public License as | |
6 | * published by the Free Software Foundation; either version 2 of the | |
7 | * License, or (at your option) any later version. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | * General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public | |
15 | * License along with this program; if not, write to the | |
16 | * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, | |
17 | * Boston, MA 02110-1301 USA | |
18 | */ | |
19 | ||
20 | #include "config.h" | |
21 | ||
22 | #include "common.h" | |
23 | ||
24 | typedef struct | |
25 | { | |
26 | GIOStream *stream1; | |
27 | GIOStream *stream2; | |
28 | _GIOStreamSpliceFlags flags; | |
29 | gint io_priority; | |
30 | GCancellable *cancellable; | |
31 | gulong cancelled_id; | |
32 | GCancellable *op1_cancellable; | |
33 | GCancellable *op2_cancellable; | |
34 | guint completed; | |
35 | GError *error; | |
36 | } SpliceContext; | |
37 | ||
38 | static void | |
39 | splice_context_free (SpliceContext *ctx) | |
40 | { | |
41 | g_object_unref (ctx->stream1); | |
42 | g_object_unref (ctx->stream2); | |
43 | if (ctx->cancellable != NULL) | |
44 | g_object_unref (ctx->cancellable); | |
45 | g_object_unref (ctx->op1_cancellable); | |
46 | g_object_unref (ctx->op2_cancellable); | |
47 | g_clear_error (&ctx->error); | |
48 | g_slice_free (SpliceContext, ctx); | |
49 | } | |
50 | ||
51 | static void | |
52 | splice_complete (GSimpleAsyncResult *simple, | |
53 | SpliceContext *ctx) | |
54 | { | |
55 | if (ctx->cancelled_id != 0) | |
56 | g_cancellable_disconnect (ctx->cancellable, ctx->cancelled_id); | |
57 | ctx->cancelled_id = 0; | |
58 | ||
59 | if (ctx->error != NULL) | |
60 | g_simple_async_result_set_from_error (simple, ctx->error); | |
61 | g_simple_async_result_complete (simple); | |
62 | } | |
63 | ||
64 | static void | |
65 | splice_close_cb (GObject *iostream, | |
66 | GAsyncResult *res, | |
67 | gpointer user_data) | |
68 | { | |
69 | GSimpleAsyncResult *simple = user_data; | |
70 | SpliceContext *ctx; | |
71 | GError *error = NULL; | |
72 | ||
73 | g_io_stream_close_finish (G_IO_STREAM (iostream), res, &error); | |
74 | ||
75 | ctx = g_simple_async_result_get_op_res_gpointer (simple); | |
76 | ctx->completed++; | |
77 | ||
78 | /* Keep the first error that occured */ | |
79 | if (error != NULL && ctx->error == NULL) | |
80 | ctx->error = error; | |
81 | else | |
82 | g_clear_error (&error); | |
83 | ||
84 | /* If all operations are done, complete now */ | |
85 | if (ctx->completed == 4) | |
86 | splice_complete (simple, ctx); | |
87 | ||
88 | g_object_unref (simple); | |
89 | } | |
90 | ||
91 | static void | |
92 | splice_cb (GObject *ostream, | |
93 | GAsyncResult *res, | |
94 | gpointer user_data) | |
95 | { | |
96 | GSimpleAsyncResult *simple = user_data; | |
97 | SpliceContext *ctx; | |
98 | GError *error = NULL; | |
99 | ||
100 | g_output_stream_splice_finish (G_OUTPUT_STREAM (ostream), res, &error); | |
101 | ||
102 | ctx = g_simple_async_result_get_op_res_gpointer (simple); | |
103 | ctx->completed++; | |
104 | ||
105 | /* ignore cancellation error if it was not requested by the user */ | |
106 | if (error != NULL && | |
107 | g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) && | |
108 | (ctx->cancellable == NULL || | |
109 | !g_cancellable_is_cancelled (ctx->cancellable))) | |
110 | g_clear_error (&error); | |
111 | ||
112 | /* Keep the first error that occured */ | |
113 | if (error != NULL && ctx->error == NULL) | |
114 | ctx->error = error; | |
115 | else | |
116 | g_clear_error (&error); | |
117 | ||
118 | if (ctx->completed == 1 && | |
119 | (ctx->flags & _G_IO_STREAM_SPLICE_WAIT_FOR_BOTH) == 0) | |
120 | { | |
121 | /* We don't want to wait for the 2nd operation to finish, cancel it */ | |
122 | g_cancellable_cancel (ctx->op1_cancellable); | |
123 | g_cancellable_cancel (ctx->op2_cancellable); | |
124 | } | |
125 | else if (ctx->completed == 2) | |
126 | { | |
127 | if (ctx->cancellable == NULL || | |
128 | !g_cancellable_is_cancelled (ctx->cancellable)) | |
129 | { | |
130 | g_cancellable_reset (ctx->op1_cancellable); | |
131 | g_cancellable_reset (ctx->op2_cancellable); | |
132 | } | |
133 | ||
134 | /* Close the IO streams if needed */ | |
135 | if ((ctx->flags & _G_IO_STREAM_SPLICE_CLOSE_STREAM1) != 0) | |
136 | g_io_stream_close_async (ctx->stream1, ctx->io_priority, | |
137 | ctx->op1_cancellable, splice_close_cb, g_object_ref (simple)); | |
138 | else | |
139 | ctx->completed++; | |
140 | ||
141 | if ((ctx->flags & _G_IO_STREAM_SPLICE_CLOSE_STREAM2) != 0) | |
142 | g_io_stream_close_async (ctx->stream2, ctx->io_priority, | |
143 | ctx->op2_cancellable, splice_close_cb, g_object_ref (simple)); | |
144 | else | |
145 | ctx->completed++; | |
146 | ||
147 | /* If all operations are done, complete now */ | |
148 | if (ctx->completed == 4) | |
149 | splice_complete (simple, ctx); | |
150 | } | |
151 | ||
152 | g_object_unref (simple); | |
153 | } | |
154 | ||
155 | static void | |
156 | splice_cancelled_cb (GCancellable *cancellable, | |
157 | GSimpleAsyncResult *simple) | |
158 | { | |
159 | SpliceContext *ctx; | |
160 | ||
161 | ctx = g_simple_async_result_get_op_res_gpointer (simple); | |
162 | g_cancellable_cancel (ctx->op1_cancellable); | |
163 | g_cancellable_cancel (ctx->op2_cancellable); | |
164 | } | |
165 | ||
166 | void | |
167 | _g_io_stream_splice_async (GIOStream *stream1, | |
168 | GIOStream *stream2, | |
169 | _GIOStreamSpliceFlags flags, | |
170 | gint io_priority, | |
171 | GCancellable *cancellable, | |
172 | GAsyncReadyCallback callback, | |
173 | gpointer user_data) | |
174 | { | |
175 | GSimpleAsyncResult *simple; | |
176 | SpliceContext *ctx; | |
177 | GInputStream *istream; | |
178 | GOutputStream *ostream; | |
179 | ||
180 | if (cancellable != NULL && g_cancellable_is_cancelled (cancellable)) | |
181 | { | |
182 | g_simple_async_report_error_in_idle (NULL, callback, | |
183 | user_data, G_IO_ERROR, G_IO_ERROR_CANCELLED, | |
184 | "Operation has been cancelled"); | |
185 | return; | |
186 | } | |
187 | ||
188 | ctx = g_slice_new0 (SpliceContext); | |
189 | ctx->stream1 = g_object_ref (stream1); | |
190 | ctx->stream2 = g_object_ref (stream2); | |
191 | ctx->flags = flags; | |
192 | ctx->io_priority = io_priority; | |
193 | ctx->op1_cancellable = g_cancellable_new (); | |
194 | ctx->op2_cancellable = g_cancellable_new (); | |
195 | ctx->completed = 0; | |
196 | ||
197 | simple = g_simple_async_result_new (NULL, callback, user_data, | |
198 | _g_io_stream_splice_finish); | |
199 | g_simple_async_result_set_op_res_gpointer (simple, ctx, | |
200 | (GDestroyNotify) splice_context_free); | |
201 | ||
202 | if (cancellable != NULL) | |
203 | { | |
204 | ctx->cancellable = g_object_ref (cancellable); | |
205 | ctx->cancelled_id = g_cancellable_connect (cancellable, | |
206 | G_CALLBACK (splice_cancelled_cb), g_object_ref (simple), | |
207 | g_object_unref); | |
208 | } | |
209 | ||
210 | istream = g_io_stream_get_input_stream (stream1); | |
211 | ostream = g_io_stream_get_output_stream (stream2); | |
212 | g_output_stream_splice_async (ostream, istream, G_OUTPUT_STREAM_SPLICE_NONE, | |
213 | io_priority, ctx->op1_cancellable, splice_cb, | |
214 | g_object_ref (simple)); | |
215 | ||
216 | istream = g_io_stream_get_input_stream (stream2); | |
217 | ostream = g_io_stream_get_output_stream (stream1); | |
218 | g_output_stream_splice_async (ostream, istream, G_OUTPUT_STREAM_SPLICE_NONE, | |
219 | io_priority, ctx->op2_cancellable, splice_cb, | |
220 | g_object_ref (simple)); | |
221 | ||
222 | g_object_unref (simple); | |
223 | } | |
224 | ||
225 | gboolean | |
226 | _g_io_stream_splice_finish (GAsyncResult *result, | |
227 | GError **error) | |
228 | { | |
229 | GSimpleAsyncResult *simple; | |
230 | ||
231 | g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (result), FALSE); | |
232 | ||
233 | simple = G_SIMPLE_ASYNC_RESULT (result); | |
234 | ||
235 | if (g_simple_async_result_propagate_error (simple, error)) | |
236 | return FALSE; | |
237 | ||
238 | g_return_val_if_fail (g_simple_async_result_is_valid (result, NULL, | |
239 | _g_io_stream_splice_finish), FALSE); | |
240 | ||
241 | return TRUE; | |
242 | } |
0 | /* | |
1 | * Copyright (C) 2010 Xavier Claessens <xclaesse@gmail.com> | |
2 | * Copyright (C) 2010 Collabora Ltd. | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or | |
5 | * modify it under the terms of the GNU General Public License as | |
6 | * published by the Free Software Foundation; either version 2 of the | |
7 | * License, or (at your option) any later version. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | * General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public | |
15 | * License along with this program; if not, write to the | |
16 | * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, | |
17 | * Boston, MA 02110-1301 USA | |
18 | */ | |
19 | ||
20 | #ifndef __COMMON_H__ | |
21 | #define __COMMON_H__ | |
22 | ||
23 | #include <gio/gio.h> | |
24 | ||
25 | #define TUBE_SERVICE "x-ssh-contact" | |
26 | ||
27 | G_BEGIN_DECLS | |
28 | ||
29 | typedef enum { | |
30 | _G_IO_STREAM_SPLICE_NONE = 0, | |
31 | _G_IO_STREAM_SPLICE_CLOSE_STREAM1 = (1 << 0), | |
32 | _G_IO_STREAM_SPLICE_CLOSE_STREAM2 = (1 << 1), | |
33 | _G_IO_STREAM_SPLICE_WAIT_FOR_BOTH = (1 << 2), | |
34 | } _GIOStreamSpliceFlags; | |
35 | ||
36 | void _g_io_stream_splice_async (GIOStream *stream1, | |
37 | GIOStream *stream2, | |
38 | _GIOStreamSpliceFlags flags, | |
39 | int io_priority, | |
40 | GCancellable *cancellable, | |
41 | GAsyncReadyCallback callback, | |
42 | gpointer user_data); | |
43 | ||
44 | gboolean _g_io_stream_splice_finish (GAsyncResult *result, | |
45 | GError **error); | |
46 | ||
47 | G_END_DECLS | |
48 | ||
49 | #endif /* #ifndef __COMMON_H__*/ |
23 | 23 | |
24 | 24 | #include <gio/gio.h> |
25 | 25 | #include <telepathy-glib/telepathy-glib.h> |
26 | ||
27 | #include "common.h" | |
28 | 26 | |
29 | 27 | static GMainLoop *loop = NULL; |
30 | 28 | static GList *channel_list = NULL; |
62 | 60 | { |
63 | 61 | GError *error = NULL; |
64 | 62 | |
65 | _g_io_stream_splice_finish (res, &error); | |
63 | g_io_stream_splice_finish (res, &error); | |
66 | 64 | session_complete (channel, error); |
67 | 65 | g_clear_error (&error); |
68 | 66 | } |
100 | 98 | sshd_connection = g_socket_connection_factory_create_connection (socket); |
101 | 99 | |
102 | 100 | /* Splice tube and ssh connections */ |
103 | _g_io_stream_splice_async (G_IO_STREAM (tube_connection), | |
104 | G_IO_STREAM (sshd_connection), _G_IO_STREAM_SPLICE_NONE, | |
101 | g_io_stream_splice_async (G_IO_STREAM (tube_connection), | |
102 | G_IO_STREAM (sshd_connection), G_IO_STREAM_SPLICE_NONE, | |
105 | 103 | G_PRIORITY_DEFAULT, NULL, splice_cb, channel); |
106 | 104 | |
107 | 105 | OUT: |
19 | 19 | tab.h tab.c \ |
20 | 20 | tree-view.h tree-view.c \ |
21 | 21 | ../client-helpers.h ../client-helpers.c \ |
22 | ../common.h ../common.c \ | |
23 | 22 | $(NULL) |
24 | 23 | |
25 | 24 | plugin_in_files = ssh-contact.vinagre-plugin.desktop.in |
74 | 74 | libssh_contact_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ |
75 | 75 | $(am__DEPENDENCIES_1) |
76 | 76 | am_libssh_contact_la_OBJECTS = plugin.lo connection.lo tab.lo \ |
77 | tree-view.lo client-helpers.lo common.lo | |
77 | tree-view.lo client-helpers.lo | |
78 | 78 | libssh_contact_la_OBJECTS = $(am_libssh_contact_la_OBJECTS) |
79 | 79 | AM_V_lt = $(am__v_lt_$(V)) |
80 | 80 | am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) |
286 | 286 | tab.h tab.c \ |
287 | 287 | tree-view.h tree-view.c \ |
288 | 288 | ../client-helpers.h ../client-helpers.c \ |
289 | ../common.h ../common.c \ | |
290 | 289 | $(NULL) |
291 | 290 | |
292 | 291 | plugin_in_files = ssh-contact.vinagre-plugin.desktop.in |
369 | 368 | -rm -f *.tab.c |
370 | 369 | |
371 | 370 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/client-helpers.Plo@am__quote@ |
372 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Plo@am__quote@ | |
373 | 371 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/connection.Plo@am__quote@ |
374 | 372 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin.Plo@am__quote@ |
375 | 373 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tab.Plo@am__quote@ |
406 | 404 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../client-helpers.c' object='client-helpers.lo' libtool=yes @AMDEPBACKSLASH@ |
407 | 405 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
408 | 406 | @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o client-helpers.lo `test -f '../client-helpers.c' || echo '$(srcdir)/'`../client-helpers.c |
409 | ||
410 | common.lo: ../common.c | |
411 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT common.lo -MD -MP -MF $(DEPDIR)/common.Tpo -c -o common.lo `test -f '../common.c' || echo '$(srcdir)/'`../common.c | |
412 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/common.Tpo $(DEPDIR)/common.Plo | |
413 | @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ | |
414 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../common.c' object='common.lo' libtool=yes @AMDEPBACKSLASH@ | |
415 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | |
416 | @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o common.lo `test -f '../common.c' || echo '$(srcdir)/'`../common.c | |
417 | 407 | |
418 | 408 | mostlyclean-libtool: |
419 | 409 | -rm -f *.lo |
29 | 29 | #include "tab.h" |
30 | 30 | #include "connection.h" |
31 | 31 | #include "../client-helpers.h" |
32 | #include "../common.h" | |
33 | 32 | |
34 | 33 | struct _SshContactTabPrivate |
35 | 34 | { |
143 | 142 | SshContactTab *self = user_data; |
144 | 143 | GError *error = NULL; |
145 | 144 | |
146 | if (!_g_io_stream_splice_finish (res, &error)) | |
145 | if (!g_io_stream_splice_finish (res, &error)) | |
147 | 146 | throw_error (self, error); |
148 | 147 | else |
149 | 148 | leave (self); |
173 | 172 | self->priv->connected = TRUE; |
174 | 173 | |
175 | 174 | /* Splice tube and ssh connections */ |
176 | _g_io_stream_splice_async (G_IO_STREAM (self->priv->tube_connection), | |
177 | G_IO_STREAM (self->priv->ssh_connection), _G_IO_STREAM_SPLICE_NONE, | |
175 | g_io_stream_splice_async (G_IO_STREAM (self->priv->tube_connection), | |
176 | G_IO_STREAM (self->priv->ssh_connection), G_IO_STREAM_SPLICE_NONE, | |
178 | 177 | G_PRIORITY_DEFAULT, NULL, splice_cb, self); |
179 | 178 | } |
180 | 179 |