Merge lp:~bluetooth/ubuntu/maverick/obexd/main into lp:ubuntu/maverick/obexd
- Maverick (10.10)
- main
- Merge into maverick
Proposed by
Baptiste Mille-Mathias
Status: | Merged |
---|---|
Merge reported by: | Daniel Holbach |
Merged at revision: | not available |
Proposed branch: | lp:~bluetooth/ubuntu/maverick/obexd/main |
Merge into: | lp:ubuntu/maverick/obexd |
Diff against target: |
10631 lines (+6085/-2141) 53 files modified
ChangeLog (+45/-0) Makefile.am (+25/-7) Makefile.in (+75/-35) aclocal.m4 (+35/-0) client/main.c (+28/-3) client/session.c (+1/-1) client/transfer.c (+6/-3) compile (+143/-0) config.h.in (+3/-0) configure (+296/-24) configure.ac (+23/-1) debian/changelog (+40/-0) debian/control (+2/-1) debian/rules (+4/-0) gdbus/object.c (+6/-2) plugins/bluetooth.c (+609/-0) plugins/filesystem.c (+126/-49) plugins/filesystem.h (+2/-2) plugins/ftp.c (+145/-169) plugins/nokia-backup.c (+295/-0) plugins/opp.c (+71/-61) plugins/pbap.c (+633/-192) plugins/phonebook-dummy.c (+491/-39) plugins/phonebook-ebook.c (+332/-56) plugins/phonebook-tracker.c (+825/-0) plugins/phonebook.h (+74/-14) plugins/syncevolution.c (+80/-72) plugins/usb.c (+245/-0) plugins/vcard.c (+327/-0) plugins/vcard.h (+65/-0) src/bluetooth.c (+0/-202) src/bluetooth.h (+0/-34) src/btio.c (+12/-12) src/btio.h (+7/-7) src/dbus.h (+2/-2) src/logging.c (+32/-19) src/main.c (+32/-186) src/manager.c (+39/-412) src/mimetype.c (+45/-12) src/mimetype.h (+16/-14) src/obex-priv.h (+23/-41) src/obex.c (+422/-413) src/obex.h (+16/-13) src/plugin.c (+2/-2) src/server.c (+146/-0) src/server.h (+47/-0) src/service.c (+8/-15) src/service.h (+20/-18) src/transport.c (+91/-0) src/transport.h (+33/-0) test/ftp-client (+9/-0) test/pbap-client (+3/-0) test/pull-business-card (+28/-8) |
To merge this branch: | bzr merge lp:~bluetooth/ubuntu/maverick/obexd/main |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu branches | Pending | ||
Review via email: mp+27440@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
- 8. By Baptiste Mille-Mathias
-
* New upstream release.
- version 0.28:
+ Fix broken assumption about contacts.
+ Fix issue with exporting empty contacts.
+ Fix issue with not always including the TEL header.
+ Fix wrong response code for PBAP PUT operation.
+ Fix handling of Tracker optional parameters.
+ Fix queries for incoming and outgoing folders.
+ Fix ordering during folder listing.
+ Fix complex logic discovering the type of call.
+ Add support for the X-IRMC-CALL-DATETIME field.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'ChangeLog' | |||
2 | --- ChangeLog 2010-04-27 04:17:15 +0000 | |||
3 | +++ ChangeLog 2010-06-15 19:18:33 +0000 | |||
4 | @@ -1,3 +1,48 @@ | |||
5 | 1 | ver 0.28: | ||
6 | 2 | Fix broken assumption about contacts. | ||
7 | 3 | Fix issue with exporting empty contacts. | ||
8 | 4 | Fix issue with not always including the TEL header. | ||
9 | 5 | Fix wrong response code for PBAP PUT operation. | ||
10 | 6 | Fix handling of Tracker optional parameters. | ||
11 | 7 | Fix queries for incoming and outgoing folders. | ||
12 | 8 | Fix ordering during folder listing. | ||
13 | 9 | Fix complex logic discovering the type of call. | ||
14 | 10 | Add support for the X-IRMC-CALL-DATETIME field. | ||
15 | 11 | |||
16 | 12 | ver 0.27: | ||
17 | 13 | Fix GET name handling with FTP service. | ||
18 | 14 | Fix service driver matching when who is not specified. | ||
19 | 15 | Fix object name not being updated when agent changes it. | ||
20 | 16 | Fix inconsistency when using vCard version 2.1. | ||
21 | 17 | Fix wrong response code to PUT requests for PBAP. | ||
22 | 18 | Fix crash on PBAP SetPhoneBook function. | ||
23 | 19 | Add support for transport drivers. | ||
24 | 20 | Add support for Nokia backup plugin. | ||
25 | 21 | |||
26 | 22 | ver 0.26: | ||
27 | 23 | Fix the order of the calls handles. | ||
28 | 24 | Fix crash when receiving small objects. | ||
29 | 25 | Fix invalid memory access when removing a file. | ||
30 | 26 | Fix inverting the list with wrong search attribute. | ||
31 | 27 | Fix wrong response code for dummy PullvCardListing. | ||
32 | 28 | Fix sending the Not Found response asynchronously. | ||
33 | 29 | Fix not resetting buffered data count when resetting the session. | ||
34 | 30 | Add support for multiple telephone numbers. | ||
35 | 31 | Add support for the ADR filter. | ||
36 | 32 | |||
37 | 33 | ver 0.25: | ||
38 | 34 | Fix issue with missing phonebook-tracker.c file. | ||
39 | 35 | |||
40 | 36 | ver 0.24: | ||
41 | 37 | Fix bug when creating directories. | ||
42 | 38 | Fix error code when removing non-empty directory. | ||
43 | 39 | Fix PullBusinessCard not return transfer errors. | ||
44 | 40 | Fix MaxListCount handling for PBAP PullPhoneBook function. | ||
45 | 41 | Fix mimetype driver selection and default fallback. | ||
46 | 42 | Add support to the WHO header in mimetype drivers. | ||
47 | 43 | Add support for PBAP operations to the back-ends. | ||
48 | 44 | Add support for PBAP Tracker backend. | ||
49 | 45 | |||
50 | 1 | ver 0.23: | 46 | ver 0.23: |
51 | 2 | Fix unneeded reset of session after a CONNECT. | 47 | Fix unneeded reset of session after a CONNECT. |
52 | 3 | Fix folder and object names with enabled auto accept. | 48 | Fix folder and object names with enabled auto accept. |
53 | 4 | 49 | ||
54 | === modified file 'Makefile.am' | |||
55 | --- Makefile.am 2010-04-27 04:17:15 +0000 | |||
56 | +++ Makefile.am 2010-06-15 19:18:33 +0000 | |||
57 | @@ -29,9 +29,22 @@ | |||
58 | 29 | builtin_sources = | 29 | builtin_sources = |
59 | 30 | builtin_nodist = | 30 | builtin_nodist = |
60 | 31 | 31 | ||
61 | 32 | builtin_modules += bluetooth | ||
62 | 33 | builtin_sources += plugins/bluetooth.c | ||
63 | 34 | |||
64 | 35 | if USB | ||
65 | 36 | builtin_modules += usb | ||
66 | 37 | builtin_sources += plugins/usb.c | ||
67 | 38 | endif | ||
68 | 39 | |||
69 | 32 | builtin_modules += filesystem | 40 | builtin_modules += filesystem |
70 | 33 | builtin_sources += plugins/filesystem.c plugins/filesystem.h | 41 | builtin_sources += plugins/filesystem.c plugins/filesystem.h |
71 | 34 | 42 | ||
72 | 43 | if NOKIA_BACKUP | ||
73 | 44 | builtin_modules += backup | ||
74 | 45 | builtin_sources += plugins/nokia-backup.c | ||
75 | 46 | endif | ||
76 | 47 | |||
77 | 35 | builtin_modules += opp | 48 | builtin_modules += opp |
78 | 36 | builtin_sources += plugins/opp.c | 49 | builtin_sources += plugins/opp.c |
79 | 37 | 50 | ||
80 | @@ -39,7 +52,8 @@ | |||
81 | 39 | builtin_sources += plugins/ftp.c | 52 | builtin_sources += plugins/ftp.c |
82 | 40 | 53 | ||
83 | 41 | builtin_modules += pbap | 54 | builtin_modules += pbap |
85 | 42 | builtin_sources += plugins/pbap.c plugins/phonebook.h | 55 | builtin_sources += plugins/pbap.c plugins/phonebook.h \ |
86 | 56 | plugins/vcard.h plugins/vcard.c | ||
87 | 43 | 57 | ||
88 | 44 | builtin_modules += syncevolution | 58 | builtin_modules += syncevolution |
89 | 45 | builtin_sources += plugins/syncevolution.c | 59 | builtin_sources += plugins/syncevolution.c |
90 | @@ -52,13 +66,15 @@ | |||
91 | 52 | src/main.c src/obexd.h src/plugin.h src/plugin.c \ | 66 | src/main.c src/obexd.h src/plugin.h src/plugin.c \ |
92 | 53 | src/logging.h src/logging.c src/btio.h src/btio.c \ | 67 | src/logging.h src/logging.c src/btio.h src/btio.c \ |
93 | 54 | src/dbus.h src/manager.c src/obex.h src/obex.c \ | 68 | src/dbus.h src/manager.c src/obex.h src/obex.c \ |
95 | 55 | src/obex-priv.h src/bluetooth.h src/bluetooth.c \ | 69 | src/obex-priv.h \ |
96 | 56 | src/mimetype.h src/mimetype.c \ | 70 | src/mimetype.h src/mimetype.c \ |
98 | 57 | src/service.h src/service.c | 71 | src/service.h src/service.c \ |
99 | 72 | src/transport.h src/transport.c \ | ||
100 | 73 | src/server.h src/server.c | ||
101 | 58 | 74 | ||
102 | 59 | src_obexd_LDADD = @DBUS_LIBS@ @GLIB_LIBS@ @GTHREAD_LIBS@ \ | 75 | src_obexd_LDADD = @DBUS_LIBS@ @GLIB_LIBS@ @GTHREAD_LIBS@ \ |
103 | 60 | @EBOOK_LIBS@ @OPENOBEX_LIBS@ \ | 76 | @EBOOK_LIBS@ @OPENOBEX_LIBS@ \ |
105 | 61 | @BLUEZ_LIBS@ -ldl | 77 | @BLUEZ_LIBS@ @LIBICAL_LIBS@ -ldl |
106 | 62 | 78 | ||
107 | 63 | src_obexd_LDFLAGS = -Wl,--export-dynamic | 79 | src_obexd_LDFLAGS = -Wl,--export-dynamic |
108 | 64 | 80 | ||
109 | @@ -102,6 +118,7 @@ | |||
110 | 102 | 118 | ||
111 | 103 | AM_CFLAGS = @OPENOBEX_CFLAGS@ @BLUEZ_CFLAGS@ @EBOOK_CFLAGS@ \ | 119 | AM_CFLAGS = @OPENOBEX_CFLAGS@ @BLUEZ_CFLAGS@ @EBOOK_CFLAGS@ \ |
112 | 104 | @GTHREAD_CFLAGS@ @GLIB_CFLAGS@ @DBUS_CFLAGS@ \ | 120 | @GTHREAD_CFLAGS@ @GLIB_CFLAGS@ @DBUS_CFLAGS@ \ |
113 | 121 | @LIBICAL_CFLAGS@ \ | ||
114 | 105 | -DOBEX_PLUGIN_BUILTIN -DPLUGINDIR=\""$(plugindir)"\" | 122 | -DOBEX_PLUGIN_BUILTIN -DPLUGINDIR=\""$(plugindir)"\" |
115 | 106 | 123 | ||
116 | 107 | INCLUDES = -I$(builddir)/src -I$(srcdir)/src -I$(srcdir)/plugins \ | 124 | INCLUDES = -I$(builddir)/src -I$(srcdir)/src -I$(srcdir)/plugins \ |
117 | @@ -111,16 +128,17 @@ | |||
118 | 111 | 128 | ||
119 | 112 | EXTRA_DIST = src/genbuiltin $(doc_files) $(test_files) src/obex.conf \ | 129 | EXTRA_DIST = src/genbuiltin $(doc_files) $(test_files) src/obex.conf \ |
120 | 113 | src/obexd.service.in client/obex-client.service.in \ | 130 | src/obexd.service.in client/obex-client.service.in \ |
122 | 114 | plugins/phonebook-dummy.c plugins/phonebook-ebook.c | 131 | plugins/phonebook-dummy.c plugins/phonebook-ebook.c \ |
123 | 132 | plugins/phonebook-tracker.c | ||
124 | 115 | 133 | ||
125 | 116 | DISTCHECK_CONFIGURE_FLAGS = --enable-client --enable-server | 134 | DISTCHECK_CONFIGURE_FLAGS = --enable-client --enable-server |
126 | 117 | 135 | ||
127 | 118 | MAINTAINERCLEANFILES = Makefile.in \ | 136 | MAINTAINERCLEANFILES = Makefile.in \ |
128 | 119 | aclocal.m4 configure config.h.in config.sub config.guess \ | 137 | aclocal.m4 configure config.h.in config.sub config.guess \ |
130 | 120 | ltmain.sh depcomp missing install-sh mkinstalldirs | 138 | ltmain.sh depcomp compile missing install-sh mkinstalldirs |
131 | 121 | 139 | ||
132 | 122 | %.service: %.service.in config.log | 140 | %.service: %.service.in config.log |
133 | 123 | $(AM_V_GEN)$(SED) -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ | 141 | $(AM_V_GEN)$(SED) -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ |
134 | 124 | 142 | ||
135 | 125 | plugins/phonebook.c: plugins/@PHONEBOOK_DRIVER@ | 143 | plugins/phonebook.c: plugins/@PHONEBOOK_DRIVER@ |
137 | 126 | $(AM_V_GEN)$(LN_S) $(abs_top_srcdir)/$< $@ | 144 | $(AM_V_GEN)$(LN_S) @abs_top_srcdir@/$< $@ |
138 | 127 | 145 | ||
139 | === modified file 'Makefile.in' | |||
140 | --- Makefile.in 2010-04-27 04:17:15 +0000 | |||
141 | +++ Makefile.in 2010-06-15 19:18:33 +0000 | |||
142 | @@ -38,15 +38,20 @@ | |||
143 | 38 | host_triplet = @host@ | 38 | host_triplet = @host@ |
144 | 39 | libexec_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) | 39 | libexec_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) |
145 | 40 | @SERVER_TRUE@am__append_1 = src/obexd.service.in | 40 | @SERVER_TRUE@am__append_1 = src/obexd.service.in |
147 | 41 | @SERVER_TRUE@am__append_2 = src/obexd | 41 | @SERVER_TRUE@@USB_TRUE@am__append_2 = usb |
148 | 42 | @SERVER_TRUE@@USB_TRUE@am__append_3 = plugins/usb.c | ||
149 | 43 | @NOKIA_BACKUP_TRUE@@SERVER_TRUE@am__append_4 = backup | ||
150 | 44 | @NOKIA_BACKUP_TRUE@@SERVER_TRUE@am__append_5 = plugins/nokia-backup.c | ||
151 | 45 | @SERVER_TRUE@am__append_6 = src/obexd | ||
152 | 42 | @SERVER_TRUE@noinst_PROGRAMS = test/obex-test$(EXEEXT) | 46 | @SERVER_TRUE@noinst_PROGRAMS = test/obex-test$(EXEEXT) |
155 | 43 | @CLIENT_TRUE@am__append_3 = client/obex-client.service.in | 47 | @CLIENT_TRUE@am__append_7 = client/obex-client.service.in |
156 | 44 | @CLIENT_TRUE@am__append_4 = client/obex-client | 48 | @CLIENT_TRUE@am__append_8 = client/obex-client |
157 | 45 | subdir = . | 49 | subdir = . |
158 | 46 | DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ | 50 | DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ |
159 | 47 | $(srcdir)/Makefile.in $(srcdir)/config.h.in \ | 51 | $(srcdir)/Makefile.in $(srcdir)/config.h.in \ |
160 | 48 | $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ | 52 | $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ |
162 | 49 | config.guess config.sub depcomp install-sh ltmain.sh missing | 53 | compile config.guess config.sub depcomp install-sh ltmain.sh \ |
163 | 54 | missing | ||
164 | 50 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | 55 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
165 | 51 | am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ | 56 | am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ |
166 | 52 | $(top_srcdir)/configure.ac | 57 | $(top_srcdir)/configure.ac |
167 | @@ -108,27 +113,33 @@ | |||
168 | 108 | am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) | 113 | am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) |
169 | 109 | am__v_lt_0 = --silent | 114 | am__v_lt_0 = --silent |
170 | 110 | am__src_obexd_SOURCES_DIST = gdbus/gdbus.h gdbus/mainloop.c \ | 115 | am__src_obexd_SOURCES_DIST = gdbus/gdbus.h gdbus/mainloop.c \ |
182 | 111 | gdbus/object.c gdbus/watch.c plugins/filesystem.c \ | 116 | gdbus/object.c gdbus/watch.c plugins/bluetooth.c plugins/usb.c \ |
183 | 112 | plugins/filesystem.h plugins/opp.c plugins/ftp.c \ | 117 | plugins/filesystem.c plugins/filesystem.h \ |
184 | 113 | plugins/pbap.c plugins/phonebook.h plugins/syncevolution.c \ | 118 | plugins/nokia-backup.c plugins/opp.c plugins/ftp.c \ |
185 | 114 | src/main.c src/obexd.h src/plugin.h src/plugin.c src/logging.h \ | 119 | plugins/pbap.c plugins/phonebook.h plugins/vcard.h \ |
186 | 115 | src/logging.c src/btio.h src/btio.c src/dbus.h src/manager.c \ | 120 | plugins/vcard.c plugins/syncevolution.c src/main.c src/obexd.h \ |
187 | 116 | src/obex.h src/obex.c src/obex-priv.h src/bluetooth.h \ | 121 | src/plugin.h src/plugin.c src/logging.h src/logging.c \ |
188 | 117 | src/bluetooth.c src/mimetype.h src/mimetype.c src/service.h \ | 122 | src/btio.h src/btio.c src/dbus.h src/manager.c src/obex.h \ |
189 | 118 | src/service.c | 123 | src/obex.c src/obex-priv.h src/mimetype.h src/mimetype.c \ |
190 | 119 | @SERVER_TRUE@am__objects_3 = plugins/filesystem.$(OBJEXT) \ | 124 | src/service.h src/service.c src/transport.h src/transport.c \ |
191 | 120 | @SERVER_TRUE@ plugins/opp.$(OBJEXT) plugins/ftp.$(OBJEXT) \ | 125 | src/server.h src/server.c |
192 | 121 | @SERVER_TRUE@ plugins/pbap.$(OBJEXT) \ | 126 | @SERVER_TRUE@@USB_TRUE@am__objects_3 = plugins/usb.$(OBJEXT) |
193 | 127 | @NOKIA_BACKUP_TRUE@@SERVER_TRUE@am__objects_4 = plugins/nokia-backup.$(OBJEXT) | ||
194 | 128 | @SERVER_TRUE@am__objects_5 = plugins/bluetooth.$(OBJEXT) \ | ||
195 | 129 | @SERVER_TRUE@ $(am__objects_3) plugins/filesystem.$(OBJEXT) \ | ||
196 | 130 | @SERVER_TRUE@ $(am__objects_4) plugins/opp.$(OBJEXT) \ | ||
197 | 131 | @SERVER_TRUE@ plugins/ftp.$(OBJEXT) plugins/pbap.$(OBJEXT) \ | ||
198 | 132 | @SERVER_TRUE@ plugins/vcard.$(OBJEXT) \ | ||
199 | 122 | @SERVER_TRUE@ plugins/syncevolution.$(OBJEXT) | 133 | @SERVER_TRUE@ plugins/syncevolution.$(OBJEXT) |
201 | 123 | @SERVER_TRUE@am_src_obexd_OBJECTS = $(am__objects_1) $(am__objects_3) \ | 134 | @SERVER_TRUE@am_src_obexd_OBJECTS = $(am__objects_1) $(am__objects_5) \ |
202 | 124 | @SERVER_TRUE@ src/main.$(OBJEXT) src/plugin.$(OBJEXT) \ | 135 | @SERVER_TRUE@ src/main.$(OBJEXT) src/plugin.$(OBJEXT) \ |
203 | 125 | @SERVER_TRUE@ src/logging.$(OBJEXT) src/btio.$(OBJEXT) \ | 136 | @SERVER_TRUE@ src/logging.$(OBJEXT) src/btio.$(OBJEXT) \ |
204 | 126 | @SERVER_TRUE@ src/manager.$(OBJEXT) src/obex.$(OBJEXT) \ | 137 | @SERVER_TRUE@ src/manager.$(OBJEXT) src/obex.$(OBJEXT) \ |
210 | 127 | @SERVER_TRUE@ src/bluetooth.$(OBJEXT) src/mimetype.$(OBJEXT) \ | 138 | @SERVER_TRUE@ src/mimetype.$(OBJEXT) src/service.$(OBJEXT) \ |
211 | 128 | @SERVER_TRUE@ src/service.$(OBJEXT) | 139 | @SERVER_TRUE@ src/transport.$(OBJEXT) src/server.$(OBJEXT) |
212 | 129 | @SERVER_TRUE@am__objects_4 = plugins/phonebook.$(OBJEXT) | 140 | @SERVER_TRUE@am__objects_6 = plugins/phonebook.$(OBJEXT) |
213 | 130 | @SERVER_TRUE@am__objects_5 = $(am__objects_4) | 141 | @SERVER_TRUE@am__objects_7 = $(am__objects_6) |
214 | 131 | @SERVER_TRUE@nodist_src_obexd_OBJECTS = $(am__objects_5) | 142 | @SERVER_TRUE@nodist_src_obexd_OBJECTS = $(am__objects_7) |
215 | 132 | src_obexd_OBJECTS = $(am_src_obexd_OBJECTS) \ | 143 | src_obexd_OBJECTS = $(am_src_obexd_OBJECTS) \ |
216 | 133 | $(nodist_src_obexd_OBJECTS) | 144 | $(nodist_src_obexd_OBJECTS) |
217 | 134 | src_obexd_DEPENDENCIES = | 145 | src_obexd_DEPENDENCIES = |
218 | @@ -230,6 +241,8 @@ | |||
219 | 230 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ | 241 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ |
220 | 231 | LD = @LD@ | 242 | LD = @LD@ |
221 | 232 | LDFLAGS = @LDFLAGS@ | 243 | LDFLAGS = @LDFLAGS@ |
222 | 244 | LIBICAL_CFLAGS = @LIBICAL_CFLAGS@ | ||
223 | 245 | LIBICAL_LIBS = @LIBICAL_LIBS@ | ||
224 | 233 | LIBOBJS = @LIBOBJS@ | 246 | LIBOBJS = @LIBOBJS@ |
225 | 234 | LIBS = @LIBS@ | 247 | LIBS = @LIBS@ |
226 | 235 | LIBTOOL = @LIBTOOL@ | 248 | LIBTOOL = @LIBTOOL@ |
227 | @@ -316,7 +329,7 @@ | |||
228 | 316 | top_srcdir = @top_srcdir@ | 329 | top_srcdir = @top_srcdir@ |
229 | 317 | AM_MAKEFLAGS = --no-print-directory | 330 | AM_MAKEFLAGS = --no-print-directory |
230 | 318 | servicedir = $(datarootdir)/dbus-1/services | 331 | servicedir = $(datarootdir)/dbus-1/services |
232 | 319 | service_in_files = $(am__append_1) $(am__append_3) | 332 | service_in_files = $(am__append_1) $(am__append_7) |
233 | 320 | doc_files = doc/obexd-api.txt doc/agent-api.txt doc/client-api.txt | 333 | doc_files = doc/obexd-api.txt doc/agent-api.txt doc/client-api.txt |
234 | 321 | test_files = test/simple-agent test/send-files \ | 334 | test_files = test/simple-agent test/send-files \ |
235 | 322 | test/pull-business-card test/exchange-business-cards \ | 335 | test/pull-business-card test/exchange-business-cards \ |
236 | @@ -329,23 +342,28 @@ | |||
237 | 329 | gwobex/utils.h gwobex/utils.c gwobex/log.h | 342 | gwobex/utils.h gwobex/utils.c gwobex/log.h |
238 | 330 | 343 | ||
239 | 331 | @SERVER_TRUE@confdir = $(sysconfdir)/obex | 344 | @SERVER_TRUE@confdir = $(sysconfdir)/obex |
243 | 332 | @SERVER_TRUE@builtin_modules = filesystem opp ftp pbap syncevolution | 345 | @SERVER_TRUE@builtin_modules = bluetooth $(am__append_2) filesystem \ |
244 | 333 | @SERVER_TRUE@builtin_sources = plugins/filesystem.c \ | 346 | @SERVER_TRUE@ $(am__append_4) opp ftp pbap syncevolution |
245 | 334 | @SERVER_TRUE@ plugins/filesystem.h plugins/opp.c plugins/ftp.c \ | 347 | @SERVER_TRUE@builtin_sources = plugins/bluetooth.c $(am__append_3) \ |
246 | 348 | @SERVER_TRUE@ plugins/filesystem.c plugins/filesystem.h \ | ||
247 | 349 | @SERVER_TRUE@ $(am__append_5) plugins/opp.c plugins/ftp.c \ | ||
248 | 335 | @SERVER_TRUE@ plugins/pbap.c plugins/phonebook.h \ | 350 | @SERVER_TRUE@ plugins/pbap.c plugins/phonebook.h \ |
249 | 351 | @SERVER_TRUE@ plugins/vcard.h plugins/vcard.c \ | ||
250 | 336 | @SERVER_TRUE@ plugins/syncevolution.c | 352 | @SERVER_TRUE@ plugins/syncevolution.c |
251 | 337 | @SERVER_TRUE@builtin_nodist = plugins/phonebook.c | 353 | @SERVER_TRUE@builtin_nodist = plugins/phonebook.c |
252 | 338 | @SERVER_TRUE@src_obexd_SOURCES = $(gdbus_sources) $(builtin_sources) \ | 354 | @SERVER_TRUE@src_obexd_SOURCES = $(gdbus_sources) $(builtin_sources) \ |
253 | 339 | @SERVER_TRUE@ src/main.c src/obexd.h src/plugin.h src/plugin.c \ | 355 | @SERVER_TRUE@ src/main.c src/obexd.h src/plugin.h src/plugin.c \ |
254 | 340 | @SERVER_TRUE@ src/logging.h src/logging.c src/btio.h src/btio.c \ | 356 | @SERVER_TRUE@ src/logging.h src/logging.c src/btio.h src/btio.c \ |
255 | 341 | @SERVER_TRUE@ src/dbus.h src/manager.c src/obex.h src/obex.c \ | 357 | @SERVER_TRUE@ src/dbus.h src/manager.c src/obex.h src/obex.c \ |
257 | 342 | @SERVER_TRUE@ src/obex-priv.h src/bluetooth.h src/bluetooth.c \ | 358 | @SERVER_TRUE@ src/obex-priv.h \ |
258 | 343 | @SERVER_TRUE@ src/mimetype.h src/mimetype.c \ | 359 | @SERVER_TRUE@ src/mimetype.h src/mimetype.c \ |
260 | 344 | @SERVER_TRUE@ src/service.h src/service.c | 360 | @SERVER_TRUE@ src/service.h src/service.c \ |
261 | 361 | @SERVER_TRUE@ src/transport.h src/transport.c \ | ||
262 | 362 | @SERVER_TRUE@ src/server.h src/server.c | ||
263 | 345 | 363 | ||
264 | 346 | @SERVER_TRUE@src_obexd_LDADD = @DBUS_LIBS@ @GLIB_LIBS@ @GTHREAD_LIBS@ \ | 364 | @SERVER_TRUE@src_obexd_LDADD = @DBUS_LIBS@ @GLIB_LIBS@ @GTHREAD_LIBS@ \ |
265 | 347 | @SERVER_TRUE@ @EBOOK_LIBS@ @OPENOBEX_LIBS@ \ | 365 | @SERVER_TRUE@ @EBOOK_LIBS@ @OPENOBEX_LIBS@ \ |
267 | 348 | @SERVER_TRUE@ @BLUEZ_LIBS@ -ldl | 366 | @SERVER_TRUE@ @BLUEZ_LIBS@ @LIBICAL_LIBS@ -ldl |
268 | 349 | 367 | ||
269 | 350 | @SERVER_TRUE@src_obexd_LDFLAGS = -Wl,--export-dynamic | 368 | @SERVER_TRUE@src_obexd_LDFLAGS = -Wl,--export-dynamic |
270 | 351 | @SERVER_TRUE@builtin_files = src/builtin.h $(builtin_nodist) | 369 | @SERVER_TRUE@builtin_files = src/builtin.h $(builtin_nodist) |
271 | @@ -365,6 +383,7 @@ | |||
272 | 365 | service_DATA = $(service_in_files:.service.in=.service) | 383 | service_DATA = $(service_in_files:.service.in=.service) |
273 | 366 | AM_CFLAGS = @OPENOBEX_CFLAGS@ @BLUEZ_CFLAGS@ @EBOOK_CFLAGS@ \ | 384 | AM_CFLAGS = @OPENOBEX_CFLAGS@ @BLUEZ_CFLAGS@ @EBOOK_CFLAGS@ \ |
274 | 367 | @GTHREAD_CFLAGS@ @GLIB_CFLAGS@ @DBUS_CFLAGS@ \ | 385 | @GTHREAD_CFLAGS@ @GLIB_CFLAGS@ @DBUS_CFLAGS@ \ |
275 | 386 | @LIBICAL_CFLAGS@ \ | ||
276 | 368 | -DOBEX_PLUGIN_BUILTIN -DPLUGINDIR=\""$(plugindir)"\" | 387 | -DOBEX_PLUGIN_BUILTIN -DPLUGINDIR=\""$(plugindir)"\" |
277 | 369 | 388 | ||
278 | 370 | INCLUDES = -I$(builddir)/src -I$(srcdir)/src -I$(srcdir)/plugins \ | 389 | INCLUDES = -I$(builddir)/src -I$(srcdir)/src -I$(srcdir)/plugins \ |
279 | @@ -373,12 +392,13 @@ | |||
280 | 373 | CLEANFILES = $(service_DATA) $(builtin_files) | 392 | CLEANFILES = $(service_DATA) $(builtin_files) |
281 | 374 | EXTRA_DIST = src/genbuiltin $(doc_files) $(test_files) src/obex.conf \ | 393 | EXTRA_DIST = src/genbuiltin $(doc_files) $(test_files) src/obex.conf \ |
282 | 375 | src/obexd.service.in client/obex-client.service.in \ | 394 | src/obexd.service.in client/obex-client.service.in \ |
284 | 376 | plugins/phonebook-dummy.c plugins/phonebook-ebook.c | 395 | plugins/phonebook-dummy.c plugins/phonebook-ebook.c \ |
285 | 396 | plugins/phonebook-tracker.c | ||
286 | 377 | 397 | ||
287 | 378 | DISTCHECK_CONFIGURE_FLAGS = --enable-client --enable-server | 398 | DISTCHECK_CONFIGURE_FLAGS = --enable-client --enable-server |
288 | 379 | MAINTAINERCLEANFILES = Makefile.in \ | 399 | MAINTAINERCLEANFILES = Makefile.in \ |
289 | 380 | aclocal.m4 configure config.h.in config.sub config.guess \ | 400 | aclocal.m4 configure config.h.in config.sub config.guess \ |
291 | 381 | ltmain.sh depcomp missing install-sh mkinstalldirs | 401 | ltmain.sh depcomp compile missing install-sh mkinstalldirs |
292 | 382 | 402 | ||
293 | 383 | all: config.h | 403 | all: config.h |
294 | 384 | $(MAKE) $(AM_MAKEFLAGS) all-am | 404 | $(MAKE) $(AM_MAKEFLAGS) all-am |
295 | @@ -578,14 +598,22 @@ | |||
296 | 578 | plugins/$(DEPDIR)/$(am__dirstamp): | 598 | plugins/$(DEPDIR)/$(am__dirstamp): |
297 | 579 | @$(MKDIR_P) plugins/$(DEPDIR) | 599 | @$(MKDIR_P) plugins/$(DEPDIR) |
298 | 580 | @: > plugins/$(DEPDIR)/$(am__dirstamp) | 600 | @: > plugins/$(DEPDIR)/$(am__dirstamp) |
299 | 601 | plugins/bluetooth.$(OBJEXT): plugins/$(am__dirstamp) \ | ||
300 | 602 | plugins/$(DEPDIR)/$(am__dirstamp) | ||
301 | 603 | plugins/usb.$(OBJEXT): plugins/$(am__dirstamp) \ | ||
302 | 604 | plugins/$(DEPDIR)/$(am__dirstamp) | ||
303 | 581 | plugins/filesystem.$(OBJEXT): plugins/$(am__dirstamp) \ | 605 | plugins/filesystem.$(OBJEXT): plugins/$(am__dirstamp) \ |
304 | 582 | plugins/$(DEPDIR)/$(am__dirstamp) | 606 | plugins/$(DEPDIR)/$(am__dirstamp) |
305 | 607 | plugins/nokia-backup.$(OBJEXT): plugins/$(am__dirstamp) \ | ||
306 | 608 | plugins/$(DEPDIR)/$(am__dirstamp) | ||
307 | 583 | plugins/opp.$(OBJEXT): plugins/$(am__dirstamp) \ | 609 | plugins/opp.$(OBJEXT): plugins/$(am__dirstamp) \ |
308 | 584 | plugins/$(DEPDIR)/$(am__dirstamp) | 610 | plugins/$(DEPDIR)/$(am__dirstamp) |
309 | 585 | plugins/ftp.$(OBJEXT): plugins/$(am__dirstamp) \ | 611 | plugins/ftp.$(OBJEXT): plugins/$(am__dirstamp) \ |
310 | 586 | plugins/$(DEPDIR)/$(am__dirstamp) | 612 | plugins/$(DEPDIR)/$(am__dirstamp) |
311 | 587 | plugins/pbap.$(OBJEXT): plugins/$(am__dirstamp) \ | 613 | plugins/pbap.$(OBJEXT): plugins/$(am__dirstamp) \ |
312 | 588 | plugins/$(DEPDIR)/$(am__dirstamp) | 614 | plugins/$(DEPDIR)/$(am__dirstamp) |
313 | 615 | plugins/vcard.$(OBJEXT): plugins/$(am__dirstamp) \ | ||
314 | 616 | plugins/$(DEPDIR)/$(am__dirstamp) | ||
315 | 589 | plugins/syncevolution.$(OBJEXT): plugins/$(am__dirstamp) \ | 617 | plugins/syncevolution.$(OBJEXT): plugins/$(am__dirstamp) \ |
316 | 590 | plugins/$(DEPDIR)/$(am__dirstamp) | 618 | plugins/$(DEPDIR)/$(am__dirstamp) |
317 | 591 | src/main.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) | 619 | src/main.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) |
318 | @@ -595,12 +623,14 @@ | |||
319 | 595 | src/manager.$(OBJEXT): src/$(am__dirstamp) \ | 623 | src/manager.$(OBJEXT): src/$(am__dirstamp) \ |
320 | 596 | src/$(DEPDIR)/$(am__dirstamp) | 624 | src/$(DEPDIR)/$(am__dirstamp) |
321 | 597 | src/obex.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) | 625 | src/obex.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) |
322 | 598 | src/bluetooth.$(OBJEXT): src/$(am__dirstamp) \ | ||
323 | 599 | src/$(DEPDIR)/$(am__dirstamp) | ||
324 | 600 | src/mimetype.$(OBJEXT): src/$(am__dirstamp) \ | 626 | src/mimetype.$(OBJEXT): src/$(am__dirstamp) \ |
325 | 601 | src/$(DEPDIR)/$(am__dirstamp) | 627 | src/$(DEPDIR)/$(am__dirstamp) |
326 | 602 | src/service.$(OBJEXT): src/$(am__dirstamp) \ | 628 | src/service.$(OBJEXT): src/$(am__dirstamp) \ |
327 | 603 | src/$(DEPDIR)/$(am__dirstamp) | 629 | src/$(DEPDIR)/$(am__dirstamp) |
328 | 630 | src/transport.$(OBJEXT): src/$(am__dirstamp) \ | ||
329 | 631 | src/$(DEPDIR)/$(am__dirstamp) | ||
330 | 632 | src/server.$(OBJEXT): src/$(am__dirstamp) \ | ||
331 | 633 | src/$(DEPDIR)/$(am__dirstamp) | ||
332 | 604 | plugins/phonebook.$(OBJEXT): plugins/$(am__dirstamp) \ | 634 | plugins/phonebook.$(OBJEXT): plugins/$(am__dirstamp) \ |
333 | 605 | plugins/$(DEPDIR)/$(am__dirstamp) | 635 | plugins/$(DEPDIR)/$(am__dirstamp) |
334 | 606 | src/obexd$(EXEEXT): $(src_obexd_OBJECTS) $(src_obexd_DEPENDENCIES) src/$(am__dirstamp) | 636 | src/obexd$(EXEEXT): $(src_obexd_OBJECTS) $(src_obexd_DEPENDENCIES) src/$(am__dirstamp) |
335 | @@ -632,13 +662,16 @@ | |||
336 | 632 | -rm -f gwobex/obex-priv.$(OBJEXT) | 662 | -rm -f gwobex/obex-priv.$(OBJEXT) |
337 | 633 | -rm -f gwobex/obex-xfer.$(OBJEXT) | 663 | -rm -f gwobex/obex-xfer.$(OBJEXT) |
338 | 634 | -rm -f gwobex/utils.$(OBJEXT) | 664 | -rm -f gwobex/utils.$(OBJEXT) |
339 | 665 | -rm -f plugins/bluetooth.$(OBJEXT) | ||
340 | 635 | -rm -f plugins/filesystem.$(OBJEXT) | 666 | -rm -f plugins/filesystem.$(OBJEXT) |
341 | 636 | -rm -f plugins/ftp.$(OBJEXT) | 667 | -rm -f plugins/ftp.$(OBJEXT) |
342 | 668 | -rm -f plugins/nokia-backup.$(OBJEXT) | ||
343 | 637 | -rm -f plugins/opp.$(OBJEXT) | 669 | -rm -f plugins/opp.$(OBJEXT) |
344 | 638 | -rm -f plugins/pbap.$(OBJEXT) | 670 | -rm -f plugins/pbap.$(OBJEXT) |
345 | 639 | -rm -f plugins/phonebook.$(OBJEXT) | 671 | -rm -f plugins/phonebook.$(OBJEXT) |
346 | 640 | -rm -f plugins/syncevolution.$(OBJEXT) | 672 | -rm -f plugins/syncevolution.$(OBJEXT) |
348 | 641 | -rm -f src/bluetooth.$(OBJEXT) | 673 | -rm -f plugins/usb.$(OBJEXT) |
349 | 674 | -rm -f plugins/vcard.$(OBJEXT) | ||
350 | 642 | -rm -f src/btio.$(OBJEXT) | 675 | -rm -f src/btio.$(OBJEXT) |
351 | 643 | -rm -f src/logging.$(OBJEXT) | 676 | -rm -f src/logging.$(OBJEXT) |
352 | 644 | -rm -f src/main.$(OBJEXT) | 677 | -rm -f src/main.$(OBJEXT) |
353 | @@ -646,7 +679,9 @@ | |||
354 | 646 | -rm -f src/mimetype.$(OBJEXT) | 679 | -rm -f src/mimetype.$(OBJEXT) |
355 | 647 | -rm -f src/obex.$(OBJEXT) | 680 | -rm -f src/obex.$(OBJEXT) |
356 | 648 | -rm -f src/plugin.$(OBJEXT) | 681 | -rm -f src/plugin.$(OBJEXT) |
357 | 682 | -rm -f src/server.$(OBJEXT) | ||
358 | 649 | -rm -f src/service.$(OBJEXT) | 683 | -rm -f src/service.$(OBJEXT) |
359 | 684 | -rm -f src/transport.$(OBJEXT) | ||
360 | 650 | -rm -f test/main.$(OBJEXT) | 685 | -rm -f test/main.$(OBJEXT) |
361 | 651 | 686 | ||
362 | 652 | distclean-compile: | 687 | distclean-compile: |
363 | @@ -664,13 +699,16 @@ | |||
364 | 664 | @AMDEP_TRUE@@am__include@ @am__quote@gwobex/$(DEPDIR)/obex-priv.Po@am__quote@ | 699 | @AMDEP_TRUE@@am__include@ @am__quote@gwobex/$(DEPDIR)/obex-priv.Po@am__quote@ |
365 | 665 | @AMDEP_TRUE@@am__include@ @am__quote@gwobex/$(DEPDIR)/obex-xfer.Po@am__quote@ | 700 | @AMDEP_TRUE@@am__include@ @am__quote@gwobex/$(DEPDIR)/obex-xfer.Po@am__quote@ |
366 | 666 | @AMDEP_TRUE@@am__include@ @am__quote@gwobex/$(DEPDIR)/utils.Po@am__quote@ | 701 | @AMDEP_TRUE@@am__include@ @am__quote@gwobex/$(DEPDIR)/utils.Po@am__quote@ |
367 | 702 | @AMDEP_TRUE@@am__include@ @am__quote@plugins/$(DEPDIR)/bluetooth.Po@am__quote@ | ||
368 | 667 | @AMDEP_TRUE@@am__include@ @am__quote@plugins/$(DEPDIR)/filesystem.Po@am__quote@ | 703 | @AMDEP_TRUE@@am__include@ @am__quote@plugins/$(DEPDIR)/filesystem.Po@am__quote@ |
369 | 668 | @AMDEP_TRUE@@am__include@ @am__quote@plugins/$(DEPDIR)/ftp.Po@am__quote@ | 704 | @AMDEP_TRUE@@am__include@ @am__quote@plugins/$(DEPDIR)/ftp.Po@am__quote@ |
370 | 705 | @AMDEP_TRUE@@am__include@ @am__quote@plugins/$(DEPDIR)/nokia-backup.Po@am__quote@ | ||
371 | 669 | @AMDEP_TRUE@@am__include@ @am__quote@plugins/$(DEPDIR)/opp.Po@am__quote@ | 706 | @AMDEP_TRUE@@am__include@ @am__quote@plugins/$(DEPDIR)/opp.Po@am__quote@ |
372 | 670 | @AMDEP_TRUE@@am__include@ @am__quote@plugins/$(DEPDIR)/pbap.Po@am__quote@ | 707 | @AMDEP_TRUE@@am__include@ @am__quote@plugins/$(DEPDIR)/pbap.Po@am__quote@ |
373 | 671 | @AMDEP_TRUE@@am__include@ @am__quote@plugins/$(DEPDIR)/phonebook.Po@am__quote@ | 708 | @AMDEP_TRUE@@am__include@ @am__quote@plugins/$(DEPDIR)/phonebook.Po@am__quote@ |
374 | 672 | @AMDEP_TRUE@@am__include@ @am__quote@plugins/$(DEPDIR)/syncevolution.Po@am__quote@ | 709 | @AMDEP_TRUE@@am__include@ @am__quote@plugins/$(DEPDIR)/syncevolution.Po@am__quote@ |
376 | 673 | @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/bluetooth.Po@am__quote@ | 710 | @AMDEP_TRUE@@am__include@ @am__quote@plugins/$(DEPDIR)/usb.Po@am__quote@ |
377 | 711 | @AMDEP_TRUE@@am__include@ @am__quote@plugins/$(DEPDIR)/vcard.Po@am__quote@ | ||
378 | 674 | @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/btio.Po@am__quote@ | 712 | @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/btio.Po@am__quote@ |
379 | 675 | @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/logging.Po@am__quote@ | 713 | @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/logging.Po@am__quote@ |
380 | 676 | @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/main.Po@am__quote@ | 714 | @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/main.Po@am__quote@ |
381 | @@ -678,7 +716,9 @@ | |||
382 | 678 | @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/mimetype.Po@am__quote@ | 716 | @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/mimetype.Po@am__quote@ |
383 | 679 | @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/obex.Po@am__quote@ | 717 | @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/obex.Po@am__quote@ |
384 | 680 | @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/plugin.Po@am__quote@ | 718 | @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/plugin.Po@am__quote@ |
385 | 719 | @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/server.Po@am__quote@ | ||
386 | 681 | @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/service.Po@am__quote@ | 720 | @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/service.Po@am__quote@ |
387 | 721 | @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/transport.Po@am__quote@ | ||
388 | 682 | @AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/main.Po@am__quote@ | 722 | @AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/main.Po@am__quote@ |
389 | 683 | 723 | ||
390 | 684 | .c.o: | 724 | .c.o: |
391 | @@ -1092,7 +1132,7 @@ | |||
392 | 1092 | $(AM_V_GEN)$(SED) -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ | 1132 | $(AM_V_GEN)$(SED) -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ |
393 | 1093 | 1133 | ||
394 | 1094 | plugins/phonebook.c: plugins/@PHONEBOOK_DRIVER@ | 1134 | plugins/phonebook.c: plugins/@PHONEBOOK_DRIVER@ |
396 | 1095 | $(AM_V_GEN)$(LN_S) $(abs_top_srcdir)/$< $@ | 1135 | $(AM_V_GEN)$(LN_S) @abs_top_srcdir@/$< $@ |
397 | 1096 | 1136 | ||
398 | 1097 | # Tell versions [3.59,3.63) of GNU make to not export all variables. | 1137 | # Tell versions [3.59,3.63) of GNU make to not export all variables. |
399 | 1098 | # Otherwise a system limit (for SysV at least) may be exceeded. | 1138 | # Otherwise a system limit (for SysV at least) may be exceeded. |
400 | 1099 | 1139 | ||
401 | === modified file 'aclocal.m4' | |||
402 | --- aclocal.m4 2010-03-15 20:43:06 +0000 | |||
403 | +++ aclocal.m4 2010-06-15 19:18:33 +0000 | |||
404 | @@ -8796,6 +8796,41 @@ | |||
405 | 8796 | rm -f confinc confmf | 8796 | rm -f confinc confmf |
406 | 8797 | ]) | 8797 | ]) |
407 | 8798 | 8798 | ||
408 | 8799 | # Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 | ||
409 | 8800 | # Free Software Foundation, Inc. | ||
410 | 8801 | # | ||
411 | 8802 | # This file is free software; the Free Software Foundation | ||
412 | 8803 | # gives unlimited permission to copy and/or distribute it, | ||
413 | 8804 | # with or without modifications, as long as this notice is preserved. | ||
414 | 8805 | |||
415 | 8806 | # serial 6 | ||
416 | 8807 | |||
417 | 8808 | # AM_PROG_CC_C_O | ||
418 | 8809 | # -------------- | ||
419 | 8810 | # Like AC_PROG_CC_C_O, but changed for automake. | ||
420 | 8811 | AC_DEFUN([AM_PROG_CC_C_O], | ||
421 | 8812 | [AC_REQUIRE([AC_PROG_CC_C_O])dnl | ||
422 | 8813 | AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl | ||
423 | 8814 | AC_REQUIRE_AUX_FILE([compile])dnl | ||
424 | 8815 | # FIXME: we rely on the cache variable name because | ||
425 | 8816 | # there is no other way. | ||
426 | 8817 | set dummy $CC | ||
427 | 8818 | am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` | ||
428 | 8819 | eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o | ||
429 | 8820 | if test "$am_t" != yes; then | ||
430 | 8821 | # Losing compiler, so override with the script. | ||
431 | 8822 | # FIXME: It is wrong to rewrite CC. | ||
432 | 8823 | # But if we don't then we get into trouble of one sort or another. | ||
433 | 8824 | # A longer-term fix would be to have automake use am__CC in this case, | ||
434 | 8825 | # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" | ||
435 | 8826 | CC="$am_aux_dir/compile $CC" | ||
436 | 8827 | fi | ||
437 | 8828 | dnl Make sure AC_PROG_CC is never called again, or it will override our | ||
438 | 8829 | dnl setting of CC. | ||
439 | 8830 | m4_define([AC_PROG_CC], | ||
440 | 8831 | [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) | ||
441 | 8832 | ]) | ||
442 | 8833 | |||
443 | 8799 | # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- | 8834 | # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- |
444 | 8800 | 8835 | ||
445 | 8801 | # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 | 8836 | # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 |
446 | 8802 | 8837 | ||
447 | === modified file 'client/main.c' | |||
448 | --- client/main.c 2010-04-27 04:17:15 +0000 | |||
449 | +++ client/main.c 2010-06-15 19:18:33 +0000 | |||
450 | @@ -48,6 +48,7 @@ | |||
451 | 48 | DBusMessage *message; | 48 | DBusMessage *message; |
452 | 49 | gchar *sender; | 49 | gchar *sender; |
453 | 50 | gchar *agent; | 50 | gchar *agent; |
454 | 51 | char *filename; | ||
455 | 51 | GPtrArray *files; | 52 | GPtrArray *files; |
456 | 52 | }; | 53 | }; |
457 | 53 | 54 | ||
458 | @@ -232,12 +233,25 @@ | |||
459 | 232 | void *user_data) | 233 | void *user_data) |
460 | 233 | { | 234 | { |
461 | 234 | struct send_data *data = user_data; | 235 | struct send_data *data = user_data; |
462 | 236 | struct transfer_data *transfer = session->pending->data; | ||
463 | 237 | |||
464 | 238 | if (transfer->err != 0) { | ||
465 | 239 | DBusMessage *error = g_dbus_create_error(data->message, | ||
466 | 240 | "org.openobex.Error.Failed", | ||
467 | 241 | transfer->err > 0 ? | ||
468 | 242 | OBEX_ResponseToString(transfer->err) : | ||
469 | 243 | strerror(-transfer->err)); | ||
470 | 244 | g_dbus_send_message(data->connection, error); | ||
471 | 245 | goto done; | ||
472 | 246 | } | ||
473 | 235 | 247 | ||
474 | 236 | g_dbus_send_reply(data->connection, data->message, DBUS_TYPE_INVALID); | 248 | g_dbus_send_reply(data->connection, data->message, DBUS_TYPE_INVALID); |
475 | 237 | 249 | ||
476 | 250 | done: | ||
477 | 238 | shutdown_session(session); | 251 | shutdown_session(session); |
478 | 239 | dbus_message_unref(data->message); | 252 | dbus_message_unref(data->message); |
479 | 240 | dbus_connection_unref(data->connection); | 253 | dbus_connection_unref(data->connection); |
480 | 254 | g_free(data->filename); | ||
481 | 241 | g_free(data->sender); | 255 | g_free(data->sender); |
482 | 242 | g_free(data); | 256 | g_free(data); |
483 | 243 | } | 257 | } |
484 | @@ -256,9 +270,8 @@ | |||
485 | 256 | } | 270 | } |
486 | 257 | 271 | ||
487 | 258 | session_set_owner(session, data->sender, owner_exit); | 272 | session_set_owner(session, data->sender, owner_exit); |
488 | 259 | g_dbus_send_reply(data->connection, data->message, DBUS_TYPE_INVALID); | ||
489 | 260 | 273 | ||
491 | 261 | session_pull(session, "text/x-vcard", "/tmp/x.vcf", | 274 | session_pull(session, "text/x-vcard", data->filename, |
492 | 262 | pull_complete_callback, data); | 275 | pull_complete_callback, data); |
493 | 263 | 276 | ||
494 | 264 | return; | 277 | return; |
495 | @@ -266,6 +279,7 @@ | |||
496 | 266 | done: | 279 | done: |
497 | 267 | dbus_message_unref(data->message); | 280 | dbus_message_unref(data->message); |
498 | 268 | dbus_connection_unref(data->connection); | 281 | dbus_connection_unref(data->connection); |
499 | 282 | g_free(data->filename); | ||
500 | 269 | g_free(data->sender); | 283 | g_free(data->sender); |
501 | 270 | g_free(data); | 284 | g_free(data); |
502 | 271 | } | 285 | } |
503 | @@ -277,6 +291,7 @@ | |||
504 | 277 | struct session_data *session; | 291 | struct session_data *session; |
505 | 278 | struct send_data *data; | 292 | struct send_data *data; |
506 | 279 | const char *source = NULL, *dest = NULL, *target = NULL; | 293 | const char *source = NULL, *dest = NULL, *target = NULL; |
507 | 294 | const char *name = NULL; | ||
508 | 280 | uint8_t channel = 0; | 295 | uint8_t channel = 0; |
509 | 281 | 296 | ||
510 | 282 | dbus_message_iter_init(message, &iter); | 297 | dbus_message_iter_init(message, &iter); |
511 | @@ -287,6 +302,14 @@ | |||
512 | 287 | return g_dbus_create_error(message, | 302 | return g_dbus_create_error(message, |
513 | 288 | "org.openobex.Error.InvalidArguments", NULL); | 303 | "org.openobex.Error.InvalidArguments", NULL); |
514 | 289 | 304 | ||
515 | 305 | dbus_message_iter_next(&iter); | ||
516 | 306 | |||
517 | 307 | if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING) | ||
518 | 308 | return g_dbus_create_error(message, | ||
519 | 309 | "org.openobex.Error.InvalidArguments", NULL); | ||
520 | 310 | |||
521 | 311 | dbus_message_iter_get_basic(&iter, &name); | ||
522 | 312 | |||
523 | 290 | data = g_try_malloc0(sizeof(*data)); | 313 | data = g_try_malloc0(sizeof(*data)); |
524 | 291 | if (data == NULL) | 314 | if (data == NULL) |
525 | 292 | return g_dbus_create_error(message, | 315 | return g_dbus_create_error(message, |
526 | @@ -295,6 +318,7 @@ | |||
527 | 295 | data->connection = dbus_connection_ref(connection); | 318 | data->connection = dbus_connection_ref(connection); |
528 | 296 | data->message = dbus_message_ref(message); | 319 | data->message = dbus_message_ref(message); |
529 | 297 | data->sender = g_strdup(dbus_message_get_sender(message)); | 320 | data->sender = g_strdup(dbus_message_get_sender(message)); |
530 | 321 | data->filename = g_strdup(name); | ||
531 | 298 | 322 | ||
532 | 299 | session = session_create(source, dest, "OPP", channel, | 323 | session = session_create(source, dest, "OPP", channel, |
533 | 300 | pull_session_callback, data); | 324 | pull_session_callback, data); |
534 | @@ -306,6 +330,7 @@ | |||
535 | 306 | dbus_message_unref(data->message); | 330 | dbus_message_unref(data->message); |
536 | 307 | dbus_connection_unref(data->connection); | 331 | dbus_connection_unref(data->connection); |
537 | 308 | g_free(data->sender); | 332 | g_free(data->sender); |
538 | 333 | g_free(data->filename); | ||
539 | 309 | g_free(data); | 334 | g_free(data); |
540 | 310 | 335 | ||
541 | 311 | return g_dbus_create_error(message, "org.openobex.Error.Failed", NULL); | 336 | return g_dbus_create_error(message, "org.openobex.Error.Failed", NULL); |
542 | @@ -379,7 +404,7 @@ | |||
543 | 379 | const gchar *sender, *path; | 404 | const gchar *sender, *path; |
544 | 380 | 405 | ||
545 | 381 | if (dbus_message_get_args(message, NULL, | 406 | if (dbus_message_get_args(message, NULL, |
547 | 382 | DBUS_TYPE_STRING, &path, | 407 | DBUS_TYPE_OBJECT_PATH, &path, |
548 | 383 | DBUS_TYPE_INVALID) == FALSE) | 408 | DBUS_TYPE_INVALID) == FALSE) |
549 | 384 | return g_dbus_create_error(message, | 409 | return g_dbus_create_error(message, |
550 | 385 | "org.openobex.Error.InvalidArguments", NULL); | 410 | "org.openobex.Error.InvalidArguments", NULL); |
551 | 386 | 411 | ||
552 | === modified file 'client/session.c' | |||
553 | --- client/session.c 2010-04-27 04:17:15 +0000 | |||
554 | +++ client/session.c 2010-06-15 19:18:33 +0000 | |||
555 | @@ -1278,7 +1278,7 @@ | |||
556 | 1278 | if (session->obex == NULL) | 1278 | if (session->obex == NULL) |
557 | 1279 | return -ENOTCONN; | 1279 | return -ENOTCONN; |
558 | 1280 | 1280 | ||
560 | 1281 | transfer = transfer_register(session, NULL, NULL, type, NULL); | 1281 | transfer = transfer_register(session, NULL, filename, type, NULL); |
561 | 1282 | if (transfer == NULL) { | 1282 | if (transfer == NULL) { |
562 | 1283 | return -EIO; | 1283 | return -EIO; |
563 | 1284 | } | 1284 | } |
564 | 1285 | 1285 | ||
565 | === modified file 'client/transfer.c' | |||
566 | --- client/transfer.c 2010-04-27 04:17:15 +0000 | |||
567 | +++ client/transfer.c 2010-06-15 19:18:33 +0000 | |||
568 | @@ -406,17 +406,20 @@ | |||
569 | 406 | if (transfer->xfer != NULL) | 406 | if (transfer->xfer != NULL) |
570 | 407 | return -EALREADY; | 407 | return -EALREADY; |
571 | 408 | 408 | ||
573 | 409 | if (transfer->type == NULL) { | 409 | if (g_strcmp0(transfer->type, "x-bt/vcard-listing") == 0 || |
574 | 410 | g_strcmp0(transfer->type, "x-obex/folder-listing") == 0) | ||
575 | 411 | cb = get_xfer_listing_progress; | ||
576 | 412 | else { | ||
577 | 410 | int fd = open(transfer->name ? : transfer->filename, | 413 | int fd = open(transfer->name ? : transfer->filename, |
578 | 411 | O_WRONLY | O_CREAT, 0600); | 414 | O_WRONLY | O_CREAT, 0600); |
579 | 415 | |||
580 | 412 | if (transfer->fd < 0) { | 416 | if (transfer->fd < 0) { |
581 | 413 | error("open(): %s(%d)", strerror(errno), errno); | 417 | error("open(): %s(%d)", strerror(errno), errno); |
582 | 414 | return -errno; | 418 | return -errno; |
583 | 415 | } | 419 | } |
584 | 416 | transfer->fd = fd; | 420 | transfer->fd = fd; |
585 | 417 | cb = get_xfer_progress; | 421 | cb = get_xfer_progress; |
588 | 418 | } else | 422 | } |
587 | 419 | cb = get_xfer_listing_progress; | ||
589 | 420 | 423 | ||
590 | 421 | if (transfer->params != NULL) | 424 | if (transfer->params != NULL) |
591 | 422 | transfer->xfer = gw_obex_get_async_with_apparam(session->obex, | 425 | transfer->xfer = gw_obex_get_async_with_apparam(session->obex, |
592 | 423 | 426 | ||
593 | === added file 'compile' | |||
594 | --- compile 1970-01-01 00:00:00 +0000 | |||
595 | +++ compile 2010-06-15 19:18:33 +0000 | |||
596 | @@ -0,0 +1,143 @@ | |||
597 | 1 | #! /bin/sh | ||
598 | 2 | # Wrapper for compilers which do not understand `-c -o'. | ||
599 | 3 | |||
600 | 4 | scriptversion=2009-10-06.20; # UTC | ||
601 | 5 | |||
602 | 6 | # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software | ||
603 | 7 | # Foundation, Inc. | ||
604 | 8 | # Written by Tom Tromey <tromey@cygnus.com>. | ||
605 | 9 | # | ||
606 | 10 | # This program is free software; you can redistribute it and/or modify | ||
607 | 11 | # it under the terms of the GNU General Public License as published by | ||
608 | 12 | # the Free Software Foundation; either version 2, or (at your option) | ||
609 | 13 | # any later version. | ||
610 | 14 | # | ||
611 | 15 | # This program is distributed in the hope that it will be useful, | ||
612 | 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
613 | 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
614 | 18 | # GNU General Public License for more details. | ||
615 | 19 | # | ||
616 | 20 | # You should have received a copy of the GNU General Public License | ||
617 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
618 | 22 | |||
619 | 23 | # As a special exception to the GNU General Public License, if you | ||
620 | 24 | # distribute this file as part of a program that contains a | ||
621 | 25 | # configuration script generated by Autoconf, you may include it under | ||
622 | 26 | # the same distribution terms that you use for the rest of that program. | ||
623 | 27 | |||
624 | 28 | # This file is maintained in Automake, please report | ||
625 | 29 | # bugs to <bug-automake@gnu.org> or send patches to | ||
626 | 30 | # <automake-patches@gnu.org>. | ||
627 | 31 | |||
628 | 32 | case $1 in | ||
629 | 33 | '') | ||
630 | 34 | echo "$0: No command. Try \`$0 --help' for more information." 1>&2 | ||
631 | 35 | exit 1; | ||
632 | 36 | ;; | ||
633 | 37 | -h | --h*) | ||
634 | 38 | cat <<\EOF | ||
635 | 39 | Usage: compile [--help] [--version] PROGRAM [ARGS] | ||
636 | 40 | |||
637 | 41 | Wrapper for compilers which do not understand `-c -o'. | ||
638 | 42 | Remove `-o dest.o' from ARGS, run PROGRAM with the remaining | ||
639 | 43 | arguments, and rename the output as expected. | ||
640 | 44 | |||
641 | 45 | If you are trying to build a whole package this is not the | ||
642 | 46 | right script to run: please start by reading the file `INSTALL'. | ||
643 | 47 | |||
644 | 48 | Report bugs to <bug-automake@gnu.org>. | ||
645 | 49 | EOF | ||
646 | 50 | exit $? | ||
647 | 51 | ;; | ||
648 | 52 | -v | --v*) | ||
649 | 53 | echo "compile $scriptversion" | ||
650 | 54 | exit $? | ||
651 | 55 | ;; | ||
652 | 56 | esac | ||
653 | 57 | |||
654 | 58 | ofile= | ||
655 | 59 | cfile= | ||
656 | 60 | eat= | ||
657 | 61 | |||
658 | 62 | for arg | ||
659 | 63 | do | ||
660 | 64 | if test -n "$eat"; then | ||
661 | 65 | eat= | ||
662 | 66 | else | ||
663 | 67 | case $1 in | ||
664 | 68 | -o) | ||
665 | 69 | # configure might choose to run compile as `compile cc -o foo foo.c'. | ||
666 | 70 | # So we strip `-o arg' only if arg is an object. | ||
667 | 71 | eat=1 | ||
668 | 72 | case $2 in | ||
669 | 73 | *.o | *.obj) | ||
670 | 74 | ofile=$2 | ||
671 | 75 | ;; | ||
672 | 76 | *) | ||
673 | 77 | set x "$@" -o "$2" | ||
674 | 78 | shift | ||
675 | 79 | ;; | ||
676 | 80 | esac | ||
677 | 81 | ;; | ||
678 | 82 | *.c) | ||
679 | 83 | cfile=$1 | ||
680 | 84 | set x "$@" "$1" | ||
681 | 85 | shift | ||
682 | 86 | ;; | ||
683 | 87 | *) | ||
684 | 88 | set x "$@" "$1" | ||
685 | 89 | shift | ||
686 | 90 | ;; | ||
687 | 91 | esac | ||
688 | 92 | fi | ||
689 | 93 | shift | ||
690 | 94 | done | ||
691 | 95 | |||
692 | 96 | if test -z "$ofile" || test -z "$cfile"; then | ||
693 | 97 | # If no `-o' option was seen then we might have been invoked from a | ||
694 | 98 | # pattern rule where we don't need one. That is ok -- this is a | ||
695 | 99 | # normal compilation that the losing compiler can handle. If no | ||
696 | 100 | # `.c' file was seen then we are probably linking. That is also | ||
697 | 101 | # ok. | ||
698 | 102 | exec "$@" | ||
699 | 103 | fi | ||
700 | 104 | |||
701 | 105 | # Name of file we expect compiler to create. | ||
702 | 106 | cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` | ||
703 | 107 | |||
704 | 108 | # Create the lock directory. | ||
705 | 109 | # Note: use `[/\\:.-]' here to ensure that we don't use the same name | ||
706 | 110 | # that we are using for the .o file. Also, base the name on the expected | ||
707 | 111 | # object file name, since that is what matters with a parallel build. | ||
708 | 112 | lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d | ||
709 | 113 | while true; do | ||
710 | 114 | if mkdir "$lockdir" >/dev/null 2>&1; then | ||
711 | 115 | break | ||
712 | 116 | fi | ||
713 | 117 | sleep 1 | ||
714 | 118 | done | ||
715 | 119 | # FIXME: race condition here if user kills between mkdir and trap. | ||
716 | 120 | trap "rmdir '$lockdir'; exit 1" 1 2 15 | ||
717 | 121 | |||
718 | 122 | # Run the compile. | ||
719 | 123 | "$@" | ||
720 | 124 | ret=$? | ||
721 | 125 | |||
722 | 126 | if test -f "$cofile"; then | ||
723 | 127 | test "$cofile" = "$ofile" || mv "$cofile" "$ofile" | ||
724 | 128 | elif test -f "${cofile}bj"; then | ||
725 | 129 | test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" | ||
726 | 130 | fi | ||
727 | 131 | |||
728 | 132 | rmdir "$lockdir" | ||
729 | 133 | exit $ret | ||
730 | 134 | |||
731 | 135 | # Local Variables: | ||
732 | 136 | # mode: shell-script | ||
733 | 137 | # sh-indentation: 2 | ||
734 | 138 | # eval: (add-hook 'write-file-hooks 'time-stamp) | ||
735 | 139 | # time-stamp-start: "scriptversion=" | ||
736 | 140 | # time-stamp-format: "%:y-%02m-%02d.%02H" | ||
737 | 141 | # time-stamp-time-zone: "UTC" | ||
738 | 142 | # time-stamp-end: "; # UTC" | ||
739 | 143 | # End: | ||
740 | 0 | 144 | ||
741 | === modified file 'config.h.in' | |||
742 | --- config.h.in 2010-03-15 20:43:06 +0000 | |||
743 | +++ config.h.in 2010-06-15 19:18:33 +0000 | |||
744 | @@ -52,6 +52,9 @@ | |||
745 | 52 | /* Define if threading support is required */ | 52 | /* Define if threading support is required */ |
746 | 53 | #undef NEED_THREADS | 53 | #undef NEED_THREADS |
747 | 54 | 54 | ||
748 | 55 | /* Define to 1 if your C compiler doesn't accept -c and -o together. */ | ||
749 | 56 | #undef NO_MINUS_C_MINUS_O | ||
750 | 57 | |||
751 | 55 | /* Name of package */ | 58 | /* Name of package */ |
752 | 56 | #undef PACKAGE | 59 | #undef PACKAGE |
753 | 57 | 60 | ||
754 | 58 | 61 | ||
755 | === modified file 'configure' | |||
756 | --- configure 2010-04-27 04:17:15 +0000 | |||
757 | +++ configure 2010-06-15 19:18:33 +0000 | |||
758 | @@ -1,6 +1,6 @@ | |||
759 | 1 | #! /bin/sh | 1 | #! /bin/sh |
760 | 2 | # Guess values for system-dependent variables and create Makefiles. | 2 | # Guess values for system-dependent variables and create Makefiles. |
762 | 3 | # Generated by GNU Autoconf 2.63 for obexd 0.23. | 3 | # Generated by GNU Autoconf 2.63 for obexd 0.28. |
763 | 4 | # | 4 | # |
764 | 5 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, | 5 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, |
765 | 6 | # 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. | 6 | # 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
766 | @@ -743,8 +743,8 @@ | |||
767 | 743 | # Identity of this package. | 743 | # Identity of this package. |
768 | 744 | PACKAGE_NAME='obexd' | 744 | PACKAGE_NAME='obexd' |
769 | 745 | PACKAGE_TARNAME='obexd' | 745 | PACKAGE_TARNAME='obexd' |
772 | 746 | PACKAGE_VERSION='0.23' | 746 | PACKAGE_VERSION='0.28' |
773 | 747 | PACKAGE_STRING='obexd 0.23' | 747 | PACKAGE_STRING='obexd 0.28' |
774 | 748 | PACKAGE_BUGREPORT='' | 748 | PACKAGE_BUGREPORT='' |
775 | 749 | 749 | ||
776 | 750 | ac_default_prefix=/usr/local | 750 | ac_default_prefix=/usr/local |
777 | @@ -790,6 +790,10 @@ | |||
778 | 790 | LIBOBJS | 790 | LIBOBJS |
779 | 791 | CLIENT_FALSE | 791 | CLIENT_FALSE |
780 | 792 | CLIENT_TRUE | 792 | CLIENT_TRUE |
781 | 793 | NOKIA_BACKUP_FALSE | ||
782 | 794 | NOKIA_BACKUP_TRUE | ||
783 | 795 | USB_FALSE | ||
784 | 796 | USB_TRUE | ||
785 | 793 | SERVER_FALSE | 797 | SERVER_FALSE |
786 | 794 | SERVER_TRUE | 798 | SERVER_TRUE |
787 | 795 | PHONEBOOK_DRIVER | 799 | PHONEBOOK_DRIVER |
788 | @@ -797,6 +801,8 @@ | |||
789 | 797 | GTHREAD_CFLAGS | 801 | GTHREAD_CFLAGS |
790 | 798 | EBOOK_LIBS | 802 | EBOOK_LIBS |
791 | 799 | EBOOK_CFLAGS | 803 | EBOOK_CFLAGS |
792 | 804 | LIBICAL_LIBS | ||
793 | 805 | LIBICAL_CFLAGS | ||
794 | 800 | BLUEZ_LIBS | 806 | BLUEZ_LIBS |
795 | 801 | BLUEZ_CFLAGS | 807 | BLUEZ_CFLAGS |
796 | 802 | OPENOBEX_LIBS | 808 | OPENOBEX_LIBS |
797 | @@ -931,6 +937,8 @@ | |||
798 | 931 | enable_debug | 937 | enable_debug |
799 | 932 | with_phonebook | 938 | with_phonebook |
800 | 933 | enable_server | 939 | enable_server |
801 | 940 | enable_usb | ||
802 | 941 | enable_nokia_backup | ||
803 | 934 | enable_client | 942 | enable_client |
804 | 935 | ' | 943 | ' |
805 | 936 | ac_precious_vars='build_alias | 944 | ac_precious_vars='build_alias |
806 | @@ -951,6 +959,8 @@ | |||
807 | 951 | OPENOBEX_LIBS | 959 | OPENOBEX_LIBS |
808 | 952 | BLUEZ_CFLAGS | 960 | BLUEZ_CFLAGS |
809 | 953 | BLUEZ_LIBS | 961 | BLUEZ_LIBS |
810 | 962 | LIBICAL_CFLAGS | ||
811 | 963 | LIBICAL_LIBS | ||
812 | 954 | EBOOK_CFLAGS | 964 | EBOOK_CFLAGS |
813 | 955 | EBOOK_LIBS | 965 | EBOOK_LIBS |
814 | 956 | GTHREAD_CFLAGS | 966 | GTHREAD_CFLAGS |
815 | @@ -1507,7 +1517,7 @@ | |||
816 | 1507 | # Omit some internal or obsolete options to make the list less imposing. | 1517 | # Omit some internal or obsolete options to make the list less imposing. |
817 | 1508 | # This message is too long to be a string in the A/UX 3.1 sh. | 1518 | # This message is too long to be a string in the A/UX 3.1 sh. |
818 | 1509 | cat <<_ACEOF | 1519 | cat <<_ACEOF |
820 | 1510 | \`configure' configures obexd 0.23 to adapt to many kinds of systems. | 1520 | \`configure' configures obexd 0.28 to adapt to many kinds of systems. |
821 | 1511 | 1521 | ||
822 | 1512 | Usage: $0 [OPTION]... [VAR=VALUE]... | 1522 | Usage: $0 [OPTION]... [VAR=VALUE]... |
823 | 1513 | 1523 | ||
824 | @@ -1577,7 +1587,7 @@ | |||
825 | 1577 | 1587 | ||
826 | 1578 | if test -n "$ac_init_help"; then | 1588 | if test -n "$ac_init_help"; then |
827 | 1579 | case $ac_init_help in | 1589 | case $ac_init_help in |
829 | 1580 | short | recursive ) echo "Configuration of obexd 0.23:";; | 1590 | short | recursive ) echo "Configuration of obexd 0.28:";; |
830 | 1581 | esac | 1591 | esac |
831 | 1582 | cat <<\_ACEOF | 1592 | cat <<\_ACEOF |
832 | 1583 | 1593 | ||
833 | @@ -1599,6 +1609,8 @@ | |||
834 | 1599 | --disable-optimization disable code optimization through compiler | 1609 | --disable-optimization disable code optimization through compiler |
835 | 1600 | --enable-debug enable compiling with debugging information | 1610 | --enable-debug enable compiling with debugging information |
836 | 1601 | --disable-server disable compilation of OBEX server | 1611 | --disable-server disable compilation of OBEX server |
837 | 1612 | --enable-usb enable usb plugin | ||
838 | 1613 | --enable-nokia-backup enable nokia-backup plugin | ||
839 | 1602 | --disable-client disable compilation of OBEX client | 1614 | --disable-client disable compilation of OBEX client |
840 | 1603 | 1615 | ||
841 | 1604 | Optional Packages: | 1616 | Optional Packages: |
842 | @@ -1630,6 +1642,10 @@ | |||
843 | 1630 | BLUEZ_CFLAGS | 1642 | BLUEZ_CFLAGS |
844 | 1631 | C compiler flags for BLUEZ, overriding pkg-config | 1643 | C compiler flags for BLUEZ, overriding pkg-config |
845 | 1632 | BLUEZ_LIBS linker flags for BLUEZ, overriding pkg-config | 1644 | BLUEZ_LIBS linker flags for BLUEZ, overriding pkg-config |
846 | 1645 | LIBICAL_CFLAGS | ||
847 | 1646 | C compiler flags for LIBICAL, overriding pkg-config | ||
848 | 1647 | LIBICAL_LIBS | ||
849 | 1648 | linker flags for LIBICAL, overriding pkg-config | ||
850 | 1633 | EBOOK_CFLAGS | 1649 | EBOOK_CFLAGS |
851 | 1634 | C compiler flags for EBOOK, overriding pkg-config | 1650 | C compiler flags for EBOOK, overriding pkg-config |
852 | 1635 | EBOOK_LIBS linker flags for EBOOK, overriding pkg-config | 1651 | EBOOK_LIBS linker flags for EBOOK, overriding pkg-config |
853 | @@ -1703,7 +1719,7 @@ | |||
854 | 1703 | test -n "$ac_init_help" && exit $ac_status | 1719 | test -n "$ac_init_help" && exit $ac_status |
855 | 1704 | if $ac_init_version; then | 1720 | if $ac_init_version; then |
856 | 1705 | cat <<\_ACEOF | 1721 | cat <<\_ACEOF |
858 | 1706 | obexd configure 0.23 | 1722 | obexd configure 0.28 |
859 | 1707 | generated by GNU Autoconf 2.63 | 1723 | generated by GNU Autoconf 2.63 |
860 | 1708 | 1724 | ||
861 | 1709 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, | 1725 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, |
862 | @@ -1717,7 +1733,7 @@ | |||
863 | 1717 | This file contains any messages produced by compilers while | 1733 | This file contains any messages produced by compilers while |
864 | 1718 | running configure, to aid debugging if configure makes a mistake. | 1734 | running configure, to aid debugging if configure makes a mistake. |
865 | 1719 | 1735 | ||
867 | 1720 | It was created by obexd $as_me 0.23, which was | 1736 | It was created by obexd $as_me 0.28, which was |
868 | 1721 | generated by GNU Autoconf 2.63. Invocation command line was | 1737 | generated by GNU Autoconf 2.63. Invocation command line was |
869 | 1722 | 1738 | ||
870 | 1723 | $ $0 $@ | 1739 | $ $0 $@ |
871 | @@ -2567,7 +2583,7 @@ | |||
872 | 2567 | 2583 | ||
873 | 2568 | # Define the identity of the package. | 2584 | # Define the identity of the package. |
874 | 2569 | PACKAGE='obexd' | 2585 | PACKAGE='obexd' |
876 | 2570 | VERSION='0.23' | 2586 | VERSION='0.28' |
877 | 2571 | 2587 | ||
878 | 2572 | 2588 | ||
879 | 2573 | cat >>confdefs.h <<_ACEOF | 2589 | cat >>confdefs.h <<_ACEOF |
880 | @@ -3811,6 +3827,138 @@ | |||
881 | 3811 | fi | 3827 | fi |
882 | 3812 | 3828 | ||
883 | 3813 | 3829 | ||
884 | 3830 | if test "x$CC" != xcc; then | ||
885 | 3831 | { $as_echo "$as_me:$LINENO: checking whether $CC and cc understand -c and -o together" >&5 | ||
886 | 3832 | $as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } | ||
887 | 3833 | else | ||
888 | 3834 | { $as_echo "$as_me:$LINENO: checking whether cc understands -c and -o together" >&5 | ||
889 | 3835 | $as_echo_n "checking whether cc understands -c and -o together... " >&6; } | ||
890 | 3836 | fi | ||
891 | 3837 | set dummy $CC; ac_cc=`$as_echo "$2" | | ||
892 | 3838 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` | ||
893 | 3839 | if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then | ||
894 | 3840 | $as_echo_n "(cached) " >&6 | ||
895 | 3841 | else | ||
896 | 3842 | cat >conftest.$ac_ext <<_ACEOF | ||
897 | 3843 | /* confdefs.h. */ | ||
898 | 3844 | _ACEOF | ||
899 | 3845 | cat confdefs.h >>conftest.$ac_ext | ||
900 | 3846 | cat >>conftest.$ac_ext <<_ACEOF | ||
901 | 3847 | /* end confdefs.h. */ | ||
902 | 3848 | |||
903 | 3849 | int | ||
904 | 3850 | main () | ||
905 | 3851 | { | ||
906 | 3852 | |||
907 | 3853 | ; | ||
908 | 3854 | return 0; | ||
909 | 3855 | } | ||
910 | 3856 | _ACEOF | ||
911 | 3857 | # Make sure it works both with $CC and with simple cc. | ||
912 | 3858 | # We do the test twice because some compilers refuse to overwrite an | ||
913 | 3859 | # existing .o file with -o, though they will create one. | ||
914 | 3860 | ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' | ||
915 | 3861 | rm -f conftest2.* | ||
916 | 3862 | if { (case "(($ac_try" in | ||
917 | 3863 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
918 | 3864 | *) ac_try_echo=$ac_try;; | ||
919 | 3865 | esac | ||
920 | 3866 | eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" | ||
921 | 3867 | $as_echo "$ac_try_echo") >&5 | ||
922 | 3868 | (eval "$ac_try") 2>&5 | ||
923 | 3869 | ac_status=$? | ||
924 | 3870 | $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
925 | 3871 | (exit $ac_status); } && | ||
926 | 3872 | test -f conftest2.$ac_objext && { (case "(($ac_try" in | ||
927 | 3873 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
928 | 3874 | *) ac_try_echo=$ac_try;; | ||
929 | 3875 | esac | ||
930 | 3876 | eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" | ||
931 | 3877 | $as_echo "$ac_try_echo") >&5 | ||
932 | 3878 | (eval "$ac_try") 2>&5 | ||
933 | 3879 | ac_status=$? | ||
934 | 3880 | $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
935 | 3881 | (exit $ac_status); }; | ||
936 | 3882 | then | ||
937 | 3883 | eval ac_cv_prog_cc_${ac_cc}_c_o=yes | ||
938 | 3884 | if test "x$CC" != xcc; then | ||
939 | 3885 | # Test first that cc exists at all. | ||
940 | 3886 | if { ac_try='cc -c conftest.$ac_ext >&5' | ||
941 | 3887 | { (case "(($ac_try" in | ||
942 | 3888 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
943 | 3889 | *) ac_try_echo=$ac_try;; | ||
944 | 3890 | esac | ||
945 | 3891 | eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" | ||
946 | 3892 | $as_echo "$ac_try_echo") >&5 | ||
947 | 3893 | (eval "$ac_try") 2>&5 | ||
948 | 3894 | ac_status=$? | ||
949 | 3895 | $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
950 | 3896 | (exit $ac_status); }; }; then | ||
951 | 3897 | ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' | ||
952 | 3898 | rm -f conftest2.* | ||
953 | 3899 | if { (case "(($ac_try" in | ||
954 | 3900 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
955 | 3901 | *) ac_try_echo=$ac_try;; | ||
956 | 3902 | esac | ||
957 | 3903 | eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" | ||
958 | 3904 | $as_echo "$ac_try_echo") >&5 | ||
959 | 3905 | (eval "$ac_try") 2>&5 | ||
960 | 3906 | ac_status=$? | ||
961 | 3907 | $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
962 | 3908 | (exit $ac_status); } && | ||
963 | 3909 | test -f conftest2.$ac_objext && { (case "(($ac_try" in | ||
964 | 3910 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | ||
965 | 3911 | *) ac_try_echo=$ac_try;; | ||
966 | 3912 | esac | ||
967 | 3913 | eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" | ||
968 | 3914 | $as_echo "$ac_try_echo") >&5 | ||
969 | 3915 | (eval "$ac_try") 2>&5 | ||
970 | 3916 | ac_status=$? | ||
971 | 3917 | $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
972 | 3918 | (exit $ac_status); }; | ||
973 | 3919 | then | ||
974 | 3920 | # cc works too. | ||
975 | 3921 | : | ||
976 | 3922 | else | ||
977 | 3923 | # cc exists but doesn't like -o. | ||
978 | 3924 | eval ac_cv_prog_cc_${ac_cc}_c_o=no | ||
979 | 3925 | fi | ||
980 | 3926 | fi | ||
981 | 3927 | fi | ||
982 | 3928 | else | ||
983 | 3929 | eval ac_cv_prog_cc_${ac_cc}_c_o=no | ||
984 | 3930 | fi | ||
985 | 3931 | rm -f core conftest* | ||
986 | 3932 | |||
987 | 3933 | fi | ||
988 | 3934 | if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then | ||
989 | 3935 | { $as_echo "$as_me:$LINENO: result: yes" >&5 | ||
990 | 3936 | $as_echo "yes" >&6; } | ||
991 | 3937 | else | ||
992 | 3938 | { $as_echo "$as_me:$LINENO: result: no" >&5 | ||
993 | 3939 | $as_echo "no" >&6; } | ||
994 | 3940 | |||
995 | 3941 | cat >>confdefs.h <<\_ACEOF | ||
996 | 3942 | #define NO_MINUS_C_MINUS_O 1 | ||
997 | 3943 | _ACEOF | ||
998 | 3944 | |||
999 | 3945 | fi | ||
1000 | 3946 | |||
1001 | 3947 | # FIXME: we rely on the cache variable name because | ||
1002 | 3948 | # there is no other way. | ||
1003 | 3949 | set dummy $CC | ||
1004 | 3950 | am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` | ||
1005 | 3951 | eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o | ||
1006 | 3952 | if test "$am_t" != yes; then | ||
1007 | 3953 | # Losing compiler, so override with the script. | ||
1008 | 3954 | # FIXME: It is wrong to rewrite CC. | ||
1009 | 3955 | # But if we don't then we get into trouble of one sort or another. | ||
1010 | 3956 | # A longer-term fix would be to have automake use am__CC in this case, | ||
1011 | 3957 | # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" | ||
1012 | 3958 | CC="$am_aux_dir/compile $CC" | ||
1013 | 3959 | fi | ||
1014 | 3960 | |||
1015 | 3961 | |||
1016 | 3814 | 3962 | ||
1017 | 3815 | { $as_echo "$as_me:$LINENO: checking whether ${CC-cc} accepts -fPIE" >&5 | 3963 | { $as_echo "$as_me:$LINENO: checking whether ${CC-cc} accepts -fPIE" >&5 |
1018 | 3816 | $as_echo_n "checking whether ${CC-cc} accepts -fPIE... " >&6; } | 3964 | $as_echo_n "checking whether ${CC-cc} accepts -fPIE... " >&6; } |
1019 | @@ -4731,13 +4879,13 @@ | |||
1020 | 4731 | else | 4879 | else |
1021 | 4732 | lt_cv_nm_interface="BSD nm" | 4880 | lt_cv_nm_interface="BSD nm" |
1022 | 4733 | echo "int some_variable = 0;" > conftest.$ac_ext | 4881 | echo "int some_variable = 0;" > conftest.$ac_ext |
1024 | 4734 | (eval echo "\"\$as_me:4734: $ac_compile\"" >&5) | 4882 | (eval echo "\"\$as_me:4882: $ac_compile\"" >&5) |
1025 | 4735 | (eval "$ac_compile" 2>conftest.err) | 4883 | (eval "$ac_compile" 2>conftest.err) |
1026 | 4736 | cat conftest.err >&5 | 4884 | cat conftest.err >&5 |
1028 | 4737 | (eval echo "\"\$as_me:4737: $NM \\\"conftest.$ac_objext\\\"\"" >&5) | 4885 | (eval echo "\"\$as_me:4885: $NM \\\"conftest.$ac_objext\\\"\"" >&5) |
1029 | 4738 | (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) | 4886 | (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) |
1030 | 4739 | cat conftest.err >&5 | 4887 | cat conftest.err >&5 |
1032 | 4740 | (eval echo "\"\$as_me:4740: output\"" >&5) | 4888 | (eval echo "\"\$as_me:4888: output\"" >&5) |
1033 | 4741 | cat conftest.out >&5 | 4889 | cat conftest.out >&5 |
1034 | 4742 | if $GREP 'External.*some_variable' conftest.out > /dev/null; then | 4890 | if $GREP 'External.*some_variable' conftest.out > /dev/null; then |
1035 | 4743 | lt_cv_nm_interface="MS dumpbin" | 4891 | lt_cv_nm_interface="MS dumpbin" |
1036 | @@ -5943,7 +6091,7 @@ | |||
1037 | 5943 | ;; | 6091 | ;; |
1038 | 5944 | *-*-irix6*) | 6092 | *-*-irix6*) |
1039 | 5945 | # Find out which ABI we are using. | 6093 | # Find out which ABI we are using. |
1041 | 5946 | echo '#line 5946 "configure"' > conftest.$ac_ext | 6094 | echo '#line 6094 "configure"' > conftest.$ac_ext |
1042 | 5947 | if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 | 6095 | if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 |
1043 | 5948 | (eval $ac_compile) 2>&5 | 6096 | (eval $ac_compile) 2>&5 |
1044 | 5949 | ac_status=$? | 6097 | ac_status=$? |
1045 | @@ -7766,11 +7914,11 @@ | |||
1046 | 7766 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ | 7914 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
1047 | 7767 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ | 7915 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
1048 | 7768 | -e 's:$: $lt_compiler_flag:'` | 7916 | -e 's:$: $lt_compiler_flag:'` |
1050 | 7769 | (eval echo "\"\$as_me:7769: $lt_compile\"" >&5) | 7917 | (eval echo "\"\$as_me:7917: $lt_compile\"" >&5) |
1051 | 7770 | (eval "$lt_compile" 2>conftest.err) | 7918 | (eval "$lt_compile" 2>conftest.err) |
1052 | 7771 | ac_status=$? | 7919 | ac_status=$? |
1053 | 7772 | cat conftest.err >&5 | 7920 | cat conftest.err >&5 |
1055 | 7773 | echo "$as_me:7773: \$? = $ac_status" >&5 | 7921 | echo "$as_me:7921: \$? = $ac_status" >&5 |
1056 | 7774 | if (exit $ac_status) && test -s "$ac_outfile"; then | 7922 | if (exit $ac_status) && test -s "$ac_outfile"; then |
1057 | 7775 | # The compiler can only warn and ignore the option if not recognized | 7923 | # The compiler can only warn and ignore the option if not recognized |
1058 | 7776 | # So say no if there are warnings other than the usual output. | 7924 | # So say no if there are warnings other than the usual output. |
1059 | @@ -8105,11 +8253,11 @@ | |||
1060 | 8105 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ | 8253 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
1061 | 8106 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ | 8254 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
1062 | 8107 | -e 's:$: $lt_compiler_flag:'` | 8255 | -e 's:$: $lt_compiler_flag:'` |
1064 | 8108 | (eval echo "\"\$as_me:8108: $lt_compile\"" >&5) | 8256 | (eval echo "\"\$as_me:8256: $lt_compile\"" >&5) |
1065 | 8109 | (eval "$lt_compile" 2>conftest.err) | 8257 | (eval "$lt_compile" 2>conftest.err) |
1066 | 8110 | ac_status=$? | 8258 | ac_status=$? |
1067 | 8111 | cat conftest.err >&5 | 8259 | cat conftest.err >&5 |
1069 | 8112 | echo "$as_me:8112: \$? = $ac_status" >&5 | 8260 | echo "$as_me:8260: \$? = $ac_status" >&5 |
1070 | 8113 | if (exit $ac_status) && test -s "$ac_outfile"; then | 8261 | if (exit $ac_status) && test -s "$ac_outfile"; then |
1071 | 8114 | # The compiler can only warn and ignore the option if not recognized | 8262 | # The compiler can only warn and ignore the option if not recognized |
1072 | 8115 | # So say no if there are warnings other than the usual output. | 8263 | # So say no if there are warnings other than the usual output. |
1073 | @@ -8210,11 +8358,11 @@ | |||
1074 | 8210 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ | 8358 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
1075 | 8211 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ | 8359 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
1076 | 8212 | -e 's:$: $lt_compiler_flag:'` | 8360 | -e 's:$: $lt_compiler_flag:'` |
1078 | 8213 | (eval echo "\"\$as_me:8213: $lt_compile\"" >&5) | 8361 | (eval echo "\"\$as_me:8361: $lt_compile\"" >&5) |
1079 | 8214 | (eval "$lt_compile" 2>out/conftest.err) | 8362 | (eval "$lt_compile" 2>out/conftest.err) |
1080 | 8215 | ac_status=$? | 8363 | ac_status=$? |
1081 | 8216 | cat out/conftest.err >&5 | 8364 | cat out/conftest.err >&5 |
1083 | 8217 | echo "$as_me:8217: \$? = $ac_status" >&5 | 8365 | echo "$as_me:8365: \$? = $ac_status" >&5 |
1084 | 8218 | if (exit $ac_status) && test -s out/conftest2.$ac_objext | 8366 | if (exit $ac_status) && test -s out/conftest2.$ac_objext |
1085 | 8219 | then | 8367 | then |
1086 | 8220 | # The compiler can only warn and ignore the option if not recognized | 8368 | # The compiler can only warn and ignore the option if not recognized |
1087 | @@ -8265,11 +8413,11 @@ | |||
1088 | 8265 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ | 8413 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
1089 | 8266 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ | 8414 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
1090 | 8267 | -e 's:$: $lt_compiler_flag:'` | 8415 | -e 's:$: $lt_compiler_flag:'` |
1092 | 8268 | (eval echo "\"\$as_me:8268: $lt_compile\"" >&5) | 8416 | (eval echo "\"\$as_me:8416: $lt_compile\"" >&5) |
1093 | 8269 | (eval "$lt_compile" 2>out/conftest.err) | 8417 | (eval "$lt_compile" 2>out/conftest.err) |
1094 | 8270 | ac_status=$? | 8418 | ac_status=$? |
1095 | 8271 | cat out/conftest.err >&5 | 8419 | cat out/conftest.err >&5 |
1097 | 8272 | echo "$as_me:8272: \$? = $ac_status" >&5 | 8420 | echo "$as_me:8420: \$? = $ac_status" >&5 |
1098 | 8273 | if (exit $ac_status) && test -s out/conftest2.$ac_objext | 8421 | if (exit $ac_status) && test -s out/conftest2.$ac_objext |
1099 | 8274 | then | 8422 | then |
1100 | 8275 | # The compiler can only warn and ignore the option if not recognized | 8423 | # The compiler can only warn and ignore the option if not recognized |
1101 | @@ -11068,7 +11216,7 @@ | |||
1102 | 11068 | lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 | 11216 | lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
1103 | 11069 | lt_status=$lt_dlunknown | 11217 | lt_status=$lt_dlunknown |
1104 | 11070 | cat > conftest.$ac_ext <<_LT_EOF | 11218 | cat > conftest.$ac_ext <<_LT_EOF |
1106 | 11071 | #line 11071 "configure" | 11219 | #line 11219 "configure" |
1107 | 11072 | #include "confdefs.h" | 11220 | #include "confdefs.h" |
1108 | 11073 | 11221 | ||
1109 | 11074 | #if HAVE_DLFCN_H | 11222 | #if HAVE_DLFCN_H |
1110 | @@ -11164,7 +11312,7 @@ | |||
1111 | 11164 | lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 | 11312 | lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
1112 | 11165 | lt_status=$lt_dlunknown | 11313 | lt_status=$lt_dlunknown |
1113 | 11166 | cat > conftest.$ac_ext <<_LT_EOF | 11314 | cat > conftest.$ac_ext <<_LT_EOF |
1115 | 11167 | #line 11167 "configure" | 11315 | #line 11315 "configure" |
1116 | 11168 | #include "confdefs.h" | 11316 | #include "confdefs.h" |
1117 | 11169 | 11317 | ||
1118 | 11170 | #if HAVE_DLFCN_H | 11318 | #if HAVE_DLFCN_H |
1119 | @@ -12188,6 +12336,82 @@ | |||
1120 | 12188 | fi | 12336 | fi |
1121 | 12189 | 12337 | ||
1122 | 12190 | 12338 | ||
1123 | 12339 | if (test "${phonebook_driver}" = "dummy"); then | ||
1124 | 12340 | |||
1125 | 12341 | pkg_failed=no | ||
1126 | 12342 | { $as_echo "$as_me:$LINENO: checking for LIBICAL" >&5 | ||
1127 | 12343 | $as_echo_n "checking for LIBICAL... " >&6; } | ||
1128 | 12344 | |||
1129 | 12345 | if test -n "$LIBICAL_CFLAGS"; then | ||
1130 | 12346 | pkg_cv_LIBICAL_CFLAGS="$LIBICAL_CFLAGS" | ||
1131 | 12347 | elif test -n "$PKG_CONFIG"; then | ||
1132 | 12348 | if test -n "$PKG_CONFIG" && \ | ||
1133 | 12349 | { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libical\"") >&5 | ||
1134 | 12350 | ($PKG_CONFIG --exists --print-errors "libical") 2>&5 | ||
1135 | 12351 | ac_status=$? | ||
1136 | 12352 | $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
1137 | 12353 | (exit $ac_status); }; then | ||
1138 | 12354 | pkg_cv_LIBICAL_CFLAGS=`$PKG_CONFIG --cflags "libical" 2>/dev/null` | ||
1139 | 12355 | else | ||
1140 | 12356 | pkg_failed=yes | ||
1141 | 12357 | fi | ||
1142 | 12358 | else | ||
1143 | 12359 | pkg_failed=untried | ||
1144 | 12360 | fi | ||
1145 | 12361 | if test -n "$LIBICAL_LIBS"; then | ||
1146 | 12362 | pkg_cv_LIBICAL_LIBS="$LIBICAL_LIBS" | ||
1147 | 12363 | elif test -n "$PKG_CONFIG"; then | ||
1148 | 12364 | if test -n "$PKG_CONFIG" && \ | ||
1149 | 12365 | { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libical\"") >&5 | ||
1150 | 12366 | ($PKG_CONFIG --exists --print-errors "libical") 2>&5 | ||
1151 | 12367 | ac_status=$? | ||
1152 | 12368 | $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
1153 | 12369 | (exit $ac_status); }; then | ||
1154 | 12370 | pkg_cv_LIBICAL_LIBS=`$PKG_CONFIG --libs "libical" 2>/dev/null` | ||
1155 | 12371 | else | ||
1156 | 12372 | pkg_failed=yes | ||
1157 | 12373 | fi | ||
1158 | 12374 | else | ||
1159 | 12375 | pkg_failed=untried | ||
1160 | 12376 | fi | ||
1161 | 12377 | |||
1162 | 12378 | |||
1163 | 12379 | |||
1164 | 12380 | if test $pkg_failed = yes; then | ||
1165 | 12381 | |||
1166 | 12382 | if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then | ||
1167 | 12383 | _pkg_short_errors_supported=yes | ||
1168 | 12384 | else | ||
1169 | 12385 | _pkg_short_errors_supported=no | ||
1170 | 12386 | fi | ||
1171 | 12387 | if test $_pkg_short_errors_supported = yes; then | ||
1172 | 12388 | LIBICAL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libical" 2>&1` | ||
1173 | 12389 | else | ||
1174 | 12390 | LIBICAL_PKG_ERRORS=`$PKG_CONFIG --print-errors "libical" 2>&1` | ||
1175 | 12391 | fi | ||
1176 | 12392 | # Put the nasty error message in config.log where it belongs | ||
1177 | 12393 | echo "$LIBICAL_PKG_ERRORS" >&5 | ||
1178 | 12394 | |||
1179 | 12395 | { $as_echo "$as_me:$LINENO: result: no" >&5 | ||
1180 | 12396 | $as_echo "no" >&6; } | ||
1181 | 12397 | { { $as_echo "$as_me:$LINENO: error: libical is required" >&5 | ||
1182 | 12398 | $as_echo "$as_me: error: libical is required" >&2;} | ||
1183 | 12399 | { (exit 1); exit 1; }; } | ||
1184 | 12400 | elif test $pkg_failed = untried; then | ||
1185 | 12401 | { { $as_echo "$as_me:$LINENO: error: libical is required" >&5 | ||
1186 | 12402 | $as_echo "$as_me: error: libical is required" >&2;} | ||
1187 | 12403 | { (exit 1); exit 1; }; } | ||
1188 | 12404 | else | ||
1189 | 12405 | LIBICAL_CFLAGS=$pkg_cv_LIBICAL_CFLAGS | ||
1190 | 12406 | LIBICAL_LIBS=$pkg_cv_LIBICAL_LIBS | ||
1191 | 12407 | { $as_echo "$as_me:$LINENO: result: yes" >&5 | ||
1192 | 12408 | $as_echo "yes" >&6; } | ||
1193 | 12409 | dummy=yes | ||
1194 | 12410 | fi | ||
1195 | 12411 | |||
1196 | 12412 | |||
1197 | 12413 | fi | ||
1198 | 12414 | |||
1199 | 12191 | if (test "${phonebook_driver}" = "ebook"); then | 12415 | if (test "${phonebook_driver}" = "ebook"); then |
1200 | 12192 | 12416 | ||
1201 | 12193 | cat >>confdefs.h <<\_ACEOF | 12417 | cat >>confdefs.h <<\_ACEOF |
1202 | @@ -12363,6 +12587,40 @@ | |||
1203 | 12363 | fi | 12587 | fi |
1204 | 12364 | 12588 | ||
1205 | 12365 | 12589 | ||
1206 | 12590 | # Check whether --enable-usb was given. | ||
1207 | 12591 | if test "${enable_usb+set}" = set; then | ||
1208 | 12592 | enableval=$enable_usb; | ||
1209 | 12593 | enable_usb=${enableval} | ||
1210 | 12594 | |||
1211 | 12595 | fi | ||
1212 | 12596 | |||
1213 | 12597 | if test "${enable_usb}" = "yes" && | ||
1214 | 12598 | test "${enable_server}" != "no"; then | ||
1215 | 12599 | USB_TRUE= | ||
1216 | 12600 | USB_FALSE='#' | ||
1217 | 12601 | else | ||
1218 | 12602 | USB_TRUE='#' | ||
1219 | 12603 | USB_FALSE= | ||
1220 | 12604 | fi | ||
1221 | 12605 | |||
1222 | 12606 | |||
1223 | 12607 | # Check whether --enable-nokia_backup was given. | ||
1224 | 12608 | if test "${enable_nokia_backup+set}" = set; then | ||
1225 | 12609 | enableval=$enable_nokia_backup; | ||
1226 | 12610 | enable_nokia_backup=${enableval} | ||
1227 | 12611 | |||
1228 | 12612 | fi | ||
1229 | 12613 | |||
1230 | 12614 | if test "${enable_nokia_backup}" = "yes" && | ||
1231 | 12615 | test "${enable_server}" != "no"; then | ||
1232 | 12616 | NOKIA_BACKUP_TRUE= | ||
1233 | 12617 | NOKIA_BACKUP_FALSE='#' | ||
1234 | 12618 | else | ||
1235 | 12619 | NOKIA_BACKUP_TRUE='#' | ||
1236 | 12620 | NOKIA_BACKUP_FALSE= | ||
1237 | 12621 | fi | ||
1238 | 12622 | |||
1239 | 12623 | |||
1240 | 12366 | # Check whether --enable-client was given. | 12624 | # Check whether --enable-client was given. |
1241 | 12367 | if test "${enable_client+set}" = set; then | 12625 | if test "${enable_client+set}" = set; then |
1242 | 12368 | enableval=$enable_client; | 12626 | enableval=$enable_client; |
1243 | @@ -12514,6 +12772,20 @@ | |||
1244 | 12514 | Usually this means the macro was only invoked conditionally." >&2;} | 12772 | Usually this means the macro was only invoked conditionally." >&2;} |
1245 | 12515 | { (exit 1); exit 1; }; } | 12773 | { (exit 1); exit 1; }; } |
1246 | 12516 | fi | 12774 | fi |
1247 | 12775 | if test -z "${USB_TRUE}" && test -z "${USB_FALSE}"; then | ||
1248 | 12776 | { { $as_echo "$as_me:$LINENO: error: conditional \"USB\" was never defined. | ||
1249 | 12777 | Usually this means the macro was only invoked conditionally." >&5 | ||
1250 | 12778 | $as_echo "$as_me: error: conditional \"USB\" was never defined. | ||
1251 | 12779 | Usually this means the macro was only invoked conditionally." >&2;} | ||
1252 | 12780 | { (exit 1); exit 1; }; } | ||
1253 | 12781 | fi | ||
1254 | 12782 | if test -z "${NOKIA_BACKUP_TRUE}" && test -z "${NOKIA_BACKUP_FALSE}"; then | ||
1255 | 12783 | { { $as_echo "$as_me:$LINENO: error: conditional \"NOKIA_BACKUP\" was never defined. | ||
1256 | 12784 | Usually this means the macro was only invoked conditionally." >&5 | ||
1257 | 12785 | $as_echo "$as_me: error: conditional \"NOKIA_BACKUP\" was never defined. | ||
1258 | 12786 | Usually this means the macro was only invoked conditionally." >&2;} | ||
1259 | 12787 | { (exit 1); exit 1; }; } | ||
1260 | 12788 | fi | ||
1261 | 12517 | if test -z "${CLIENT_TRUE}" && test -z "${CLIENT_FALSE}"; then | 12789 | if test -z "${CLIENT_TRUE}" && test -z "${CLIENT_FALSE}"; then |
1262 | 12518 | { { $as_echo "$as_me:$LINENO: error: conditional \"CLIENT\" was never defined. | 12790 | { { $as_echo "$as_me:$LINENO: error: conditional \"CLIENT\" was never defined. |
1263 | 12519 | Usually this means the macro was only invoked conditionally." >&5 | 12791 | Usually this means the macro was only invoked conditionally." >&5 |
1264 | @@ -12843,7 +13115,7 @@ | |||
1265 | 12843 | # report actual input values of CONFIG_FILES etc. instead of their | 13115 | # report actual input values of CONFIG_FILES etc. instead of their |
1266 | 12844 | # values after options handling. | 13116 | # values after options handling. |
1267 | 12845 | ac_log=" | 13117 | ac_log=" |
1269 | 12846 | This file was extended by obexd $as_me 0.23, which was | 13118 | This file was extended by obexd $as_me 0.28, which was |
1270 | 12847 | generated by GNU Autoconf 2.63. Invocation command line was | 13119 | generated by GNU Autoconf 2.63. Invocation command line was |
1271 | 12848 | 13120 | ||
1272 | 12849 | CONFIG_FILES = $CONFIG_FILES | 13121 | CONFIG_FILES = $CONFIG_FILES |
1273 | @@ -12906,7 +13178,7 @@ | |||
1274 | 12906 | _ACEOF | 13178 | _ACEOF |
1275 | 12907 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 | 13179 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 |
1276 | 12908 | ac_cs_version="\\ | 13180 | ac_cs_version="\\ |
1278 | 12909 | obexd config.status 0.23 | 13181 | obexd config.status 0.28 |
1279 | 12910 | configured by $0, generated by GNU Autoconf 2.63, | 13182 | configured by $0, generated by GNU Autoconf 2.63, |
1280 | 12911 | with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" | 13183 | with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" |
1281 | 12912 | 13184 | ||
1282 | 12913 | 13185 | ||
1283 | === modified file 'configure.ac' | |||
1284 | --- configure.ac 2010-04-27 04:17:15 +0000 | |||
1285 | +++ configure.ac 2010-06-15 19:18:33 +0000 | |||
1286 | @@ -1,5 +1,5 @@ | |||
1287 | 1 | AC_PREREQ(2.60) | 1 | AC_PREREQ(2.60) |
1289 | 2 | AC_INIT(obexd, 0.23) | 2 | AC_INIT(obexd, 0.28) |
1290 | 3 | 3 | ||
1291 | 4 | AM_INIT_AUTOMAKE([foreign subdir-objects]) | 4 | AM_INIT_AUTOMAKE([foreign subdir-objects]) |
1292 | 5 | AM_CONFIG_HEADER(config.h) | 5 | AM_CONFIG_HEADER(config.h) |
1293 | @@ -30,6 +30,7 @@ | |||
1294 | 30 | AC_LANG_C | 30 | AC_LANG_C |
1295 | 31 | 31 | ||
1296 | 32 | AC_PROG_CC | 32 | AC_PROG_CC |
1297 | 33 | AM_PROG_CC_C_O | ||
1298 | 33 | AC_PROG_CC_PIE | 34 | AC_PROG_CC_PIE |
1299 | 34 | AC_PROG_INSTALL | 35 | AC_PROG_INSTALL |
1300 | 35 | AC_PROG_SED | 36 | AC_PROG_SED |
1301 | @@ -114,6 +115,13 @@ | |||
1302 | 114 | fi | 115 | fi |
1303 | 115 | ]) | 116 | ]) |
1304 | 116 | 117 | ||
1305 | 118 | if (test "${phonebook_driver}" = "dummy"); then | ||
1306 | 119 | PKG_CHECK_MODULES(LIBICAL, libical, dummy=yes, | ||
1307 | 120 | AC_MSG_ERROR(libical is required)) | ||
1308 | 121 | AC_SUBST(LIBICAL_CFLAGS) | ||
1309 | 122 | AC_SUBST(LIBICAL_LIBS) | ||
1310 | 123 | fi | ||
1311 | 124 | |||
1312 | 117 | if (test "${phonebook_driver}" = "ebook"); then | 125 | if (test "${phonebook_driver}" = "ebook"); then |
1313 | 118 | AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required]) | 126 | AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required]) |
1314 | 119 | 127 | ||
1315 | @@ -136,6 +144,20 @@ | |||
1316 | 136 | ]) | 144 | ]) |
1317 | 137 | AM_CONDITIONAL(SERVER, test "${enable_server}" != "no") | 145 | AM_CONDITIONAL(SERVER, test "${enable_server}" != "no") |
1318 | 138 | 146 | ||
1319 | 147 | AC_ARG_ENABLE(usb, AC_HELP_STRING([--enable-usb], | ||
1320 | 148 | [enable usb plugin]), [ | ||
1321 | 149 | enable_usb=${enableval} | ||
1322 | 150 | ]) | ||
1323 | 151 | AM_CONDITIONAL(USB, test "${enable_usb}" = "yes" && | ||
1324 | 152 | test "${enable_server}" != "no") | ||
1325 | 153 | |||
1326 | 154 | AC_ARG_ENABLE(nokia_backup, AC_HELP_STRING([--enable-nokia-backup], | ||
1327 | 155 | [enable nokia-backup plugin]), [ | ||
1328 | 156 | enable_nokia_backup=${enableval} | ||
1329 | 157 | ]) | ||
1330 | 158 | AM_CONDITIONAL(NOKIA_BACKUP, test "${enable_nokia_backup}" = "yes" && | ||
1331 | 159 | test "${enable_server}" != "no") | ||
1332 | 160 | |||
1333 | 139 | AC_ARG_ENABLE(client, AC_HELP_STRING([--disable-client], | 161 | AC_ARG_ENABLE(client, AC_HELP_STRING([--disable-client], |
1334 | 140 | [disable compilation of OBEX client]), [ | 162 | [disable compilation of OBEX client]), [ |
1335 | 141 | enable_client=${enableval} | 163 | enable_client=${enableval} |
1336 | 142 | 164 | ||
1337 | === modified file 'debian/changelog' | |||
1338 | --- debian/changelog 2010-04-27 04:17:15 +0000 | |||
1339 | +++ debian/changelog 2010-06-15 19:18:33 +0000 | |||
1340 | @@ -1,3 +1,43 @@ | |||
1341 | 1 | obexd (0.28-0ubuntu1) UNRELEASED; urgency=low | ||
1342 | 2 | |||
1343 | 3 | * New upstream release. | ||
1344 | 4 | - version 0.28: | ||
1345 | 5 | + Fix broken assumption about contacts. | ||
1346 | 6 | + Fix issue with exporting empty contacts. | ||
1347 | 7 | + Fix issue with not always including the TEL header. | ||
1348 | 8 | + Fix wrong response code for PBAP PUT operation. | ||
1349 | 9 | + Fix handling of Tracker optional parameters. | ||
1350 | 10 | + Fix queries for incoming and outgoing folders. | ||
1351 | 11 | + Fix ordering during folder listing. | ||
1352 | 12 | + Fix complex logic discovering the type of call. | ||
1353 | 13 | + Add support for the X-IRMC-CALL-DATETIME field. | ||
1354 | 14 | - version 0.27: | ||
1355 | 15 | + Fix GET name handling with FTP service. | ||
1356 | 16 | + Fix service driver matching when who is not specified. | ||
1357 | 17 | + Fix object name not being updated when agent changes it. | ||
1358 | 18 | + Fix inconsistency when using vCard version 2.1. | ||
1359 | 19 | + Fix wrong response code to PUT requests for PBAP. | ||
1360 | 20 | + Fix crash on PBAP SetPhoneBook function. | ||
1361 | 21 | + Add support for transport drivers. | ||
1362 | 22 | + Add support for Nokia backup plugin. | ||
1363 | 23 | - version 0.26: | ||
1364 | 24 | + Fix the order of the calls handles. | ||
1365 | 25 | + Fix crash when receiving small objects. | ||
1366 | 26 | + Fix invalid memory access when removing a file. | ||
1367 | 27 | + Fix inverting the list with wrong search attribute. | ||
1368 | 28 | + Fix wrong response code for dummy PullvCardListing. | ||
1369 | 29 | + Fix sending the Not Found response asynchronously. | ||
1370 | 30 | + Fix not resetting buffered data count when resetting the session. | ||
1371 | 31 | + Add support for multiple telephone numbers. | ||
1372 | 32 | + Add support for the ADR filter. | ||
1373 | 33 | - version 0.25: | ||
1374 | 34 | + Fix issue with missing phonebook-tracker.c file. | ||
1375 | 35 | * debian/rules: | ||
1376 | 36 | - enable usb and enable-nokia-backup plugins | ||
1377 | 37 | * New upstream release. | ||
1378 | 38 | |||
1379 | 39 | -- Baptiste Mille-Mathias <baptiste.millemathias@gmail.com> Tue, 15 Jun 2010 20:48:39 +0200 | ||
1380 | 40 | |||
1381 | 1 | obexd (0.23-1) unstable; urgency=low | 41 | obexd (0.23-1) unstable; urgency=low |
1382 | 2 | 42 | ||
1383 | 3 | * New upstream release (Closes: #558710). | 43 | * New upstream release (Closes: #558710). |
1384 | 4 | 44 | ||
1385 | === modified file 'debian/control' | |||
1386 | --- debian/control 2010-04-27 04:17:15 +0000 | |||
1387 | +++ debian/control 2010-06-15 19:18:33 +0000 | |||
1388 | @@ -7,7 +7,8 @@ | |||
1389 | 7 | libglib2.0-dev, | 7 | libglib2.0-dev, |
1390 | 8 | libdbus-1-dev, | 8 | libdbus-1-dev, |
1391 | 9 | libopenobex1-dev, | 9 | libopenobex1-dev, |
1393 | 10 | libbluetooth-dev (>= 4) | 10 | libbluetooth-dev (>= 4), |
1394 | 11 | libical-dev | ||
1395 | 11 | Vcs-Svn: svn://svn.debian.org/svn/pkg-bluetooth/packages/obexd | 12 | Vcs-Svn: svn://svn.debian.org/svn/pkg-bluetooth/packages/obexd |
1396 | 12 | Vcs-Browser: http://svn.debian.org/wsvn/pkg-bluetooth/packages/obexd | 13 | Vcs-Browser: http://svn.debian.org/wsvn/pkg-bluetooth/packages/obexd |
1397 | 13 | Homepage: http://www.bluez.org | 14 | Homepage: http://www.bluez.org |
1398 | 14 | 15 | ||
1399 | === modified file 'debian/rules' | |||
1400 | --- debian/rules 2009-07-27 19:02:30 +0000 | |||
1401 | +++ debian/rules 2010-06-15 19:18:33 +0000 | |||
1402 | @@ -3,3 +3,7 @@ | |||
1403 | 3 | include /usr/share/cdbs/1/rules/debhelper.mk | 3 | include /usr/share/cdbs/1/rules/debhelper.mk |
1404 | 4 | include /usr/share/cdbs/1/rules/simple-patchsys.mk | 4 | include /usr/share/cdbs/1/rules/simple-patchsys.mk |
1405 | 5 | include /usr/share/cdbs/1/class/autotools.mk | 5 | include /usr/share/cdbs/1/class/autotools.mk |
1406 | 6 | |||
1407 | 7 | DEB_CONFIGURE_EXTRA_FLAGS += \ | ||
1408 | 8 | --enable-usb \ | ||
1409 | 9 | --enable-nokia-backup | ||
1410 | 6 | 10 | ||
1411 | === modified file 'gdbus/object.c' | |||
1412 | --- gdbus/object.c 2010-03-15 20:43:06 +0000 | |||
1413 | +++ gdbus/object.c 2010-06-15 19:18:33 +0000 | |||
1414 | @@ -308,8 +308,10 @@ | |||
1415 | 308 | goto done; | 308 | goto done; |
1416 | 309 | 309 | ||
1417 | 310 | if (!dbus_connection_get_object_path_data(conn, parent_path, | 310 | if (!dbus_connection_get_object_path_data(conn, parent_path, |
1419 | 311 | (void *) &data)) | 311 | (void *) &data)) { |
1420 | 312 | invalidate_parent_data(conn, parent_path); | ||
1421 | 312 | goto done; | 313 | goto done; |
1422 | 314 | } | ||
1423 | 313 | 315 | ||
1424 | 314 | if (!data) | 316 | if (!data) |
1425 | 315 | goto done; | 317 | goto done; |
1426 | @@ -514,8 +516,10 @@ | |||
1427 | 514 | if (data == NULL) | 516 | if (data == NULL) |
1428 | 515 | return FALSE; | 517 | return FALSE; |
1429 | 516 | 518 | ||
1431 | 517 | if (find_interface(data->interfaces, name)) | 519 | if (find_interface(data->interfaces, name)) { |
1432 | 520 | object_path_unref(connection, path); | ||
1433 | 518 | return FALSE; | 521 | return FALSE; |
1434 | 522 | } | ||
1435 | 519 | 523 | ||
1436 | 520 | add_interface(data, name, methods, signals, | 524 | add_interface(data, name, methods, signals, |
1437 | 521 | properties, user_data, destroy); | 525 | properties, user_data, destroy); |
1438 | 522 | 526 | ||
1439 | === added file 'plugins/bluetooth.c' | |||
1440 | --- plugins/bluetooth.c 1970-01-01 00:00:00 +0000 | |||
1441 | +++ plugins/bluetooth.c 2010-06-15 19:18:33 +0000 | |||
1442 | @@ -0,0 +1,609 @@ | |||
1443 | 1 | /* | ||
1444 | 2 | * | ||
1445 | 3 | * OBEX Server | ||
1446 | 4 | * | ||
1447 | 5 | * Copyright (C) 2007-2010 Nokia Corporation | ||
1448 | 6 | * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org> | ||
1449 | 7 | * | ||
1450 | 8 | * | ||
1451 | 9 | * This program is free software; you can redistribute it and/or modify | ||
1452 | 10 | * it under the terms of the GNU General Public License as published by | ||
1453 | 11 | * the Free Software Foundation; either version 2 of the License, or | ||
1454 | 12 | * (at your option) any later version. | ||
1455 | 13 | * | ||
1456 | 14 | * This program is distributed in the hope that it will be useful, | ||
1457 | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1458 | 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1459 | 17 | * GNU General Public License for more details. | ||
1460 | 18 | * | ||
1461 | 19 | * You should have received a copy of the GNU General Public License | ||
1462 | 20 | * along with this program; if not, write to the Free Software | ||
1463 | 21 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
1464 | 22 | * | ||
1465 | 23 | */ | ||
1466 | 24 | |||
1467 | 25 | #ifdef HAVE_CONFIG_H | ||
1468 | 26 | #include <config.h> | ||
1469 | 27 | #endif | ||
1470 | 28 | |||
1471 | 29 | #include <errno.h> | ||
1472 | 30 | #include <string.h> | ||
1473 | 31 | |||
1474 | 32 | #include <openobex/obex.h> | ||
1475 | 33 | #include <openobex/obex_const.h> | ||
1476 | 34 | |||
1477 | 35 | #include <glib.h> | ||
1478 | 36 | #include <gdbus.h> | ||
1479 | 37 | |||
1480 | 38 | #include "plugin.h" | ||
1481 | 39 | #include "server.h" | ||
1482 | 40 | #include "obex.h" | ||
1483 | 41 | #include "transport.h" | ||
1484 | 42 | #include "service.h" | ||
1485 | 43 | #include "logging.h" | ||
1486 | 44 | #include "btio.h" | ||
1487 | 45 | |||
1488 | 46 | #define BT_RX_MTU 32767 | ||
1489 | 47 | #define BT_TX_MTU 32767 | ||
1490 | 48 | |||
1491 | 49 | #define TIMEOUT 60*1000 /* Timeout for user response (miliseconds) */ | ||
1492 | 50 | |||
1493 | 51 | struct pending_request { | ||
1494 | 52 | DBusPendingCall *call; | ||
1495 | 53 | struct bluetooth_service *service; | ||
1496 | 54 | char *adapter_path; | ||
1497 | 55 | char address[18]; | ||
1498 | 56 | unsigned int watch; | ||
1499 | 57 | GIOChannel *io; | ||
1500 | 58 | }; | ||
1501 | 59 | |||
1502 | 60 | struct bluetooth_service { | ||
1503 | 61 | struct obex_server *server; | ||
1504 | 62 | struct obex_service_driver *driver; | ||
1505 | 63 | uint32_t handle; | ||
1506 | 64 | }; | ||
1507 | 65 | |||
1508 | 66 | struct adapter_any { | ||
1509 | 67 | char *path; /* Adapter ANY path */ | ||
1510 | 68 | GSList *services; /* List of services to register records */ | ||
1511 | 69 | }; | ||
1512 | 70 | |||
1513 | 71 | static DBusConnection *connection = NULL; | ||
1514 | 72 | static struct adapter_any *any = NULL; | ||
1515 | 73 | |||
1516 | 74 | static void add_record_reply(DBusPendingCall *call, void *user_data) | ||
1517 | 75 | { | ||
1518 | 76 | struct bluetooth_service *service = user_data; | ||
1519 | 77 | DBusMessage *reply = dbus_pending_call_steal_reply(call); | ||
1520 | 78 | DBusError derr; | ||
1521 | 79 | uint32_t handle; | ||
1522 | 80 | |||
1523 | 81 | dbus_error_init(&derr); | ||
1524 | 82 | if (dbus_set_error_from_message(&derr, reply)) { | ||
1525 | 83 | error("bluetooth: Replied with an error: %s, %s", | ||
1526 | 84 | derr.name, derr.message); | ||
1527 | 85 | dbus_error_free(&derr); | ||
1528 | 86 | handle = 0; | ||
1529 | 87 | } else { | ||
1530 | 88 | dbus_message_get_args(reply, NULL, | ||
1531 | 89 | DBUS_TYPE_UINT32, &handle, | ||
1532 | 90 | DBUS_TYPE_INVALID); | ||
1533 | 91 | |||
1534 | 92 | service->handle = handle; | ||
1535 | 93 | |||
1536 | 94 | debug("bluetooth: Registered: %s, handle: 0x%x", | ||
1537 | 95 | service->driver->name, service->handle); | ||
1538 | 96 | } | ||
1539 | 97 | |||
1540 | 98 | dbus_message_unref(reply); | ||
1541 | 99 | } | ||
1542 | 100 | |||
1543 | 101 | static int add_record(const char *path, const char *xml, | ||
1544 | 102 | struct bluetooth_service *service) | ||
1545 | 103 | { | ||
1546 | 104 | DBusMessage *msg; | ||
1547 | 105 | DBusPendingCall *call; | ||
1548 | 106 | int ret = 0; | ||
1549 | 107 | |||
1550 | 108 | msg = dbus_message_new_method_call("org.bluez", path, | ||
1551 | 109 | "org.bluez.Service", "AddRecord"); | ||
1552 | 110 | |||
1553 | 111 | dbus_message_append_args(msg, DBUS_TYPE_STRING, &xml, | ||
1554 | 112 | DBUS_TYPE_INVALID); | ||
1555 | 113 | |||
1556 | 114 | if (dbus_connection_send_with_reply(connection, | ||
1557 | 115 | msg, &call, -1) == FALSE) { | ||
1558 | 116 | ret = -1; | ||
1559 | 117 | goto failed; | ||
1560 | 118 | } | ||
1561 | 119 | |||
1562 | 120 | dbus_pending_call_set_notify(call, add_record_reply, service, NULL); | ||
1563 | 121 | dbus_pending_call_unref(call); | ||
1564 | 122 | |||
1565 | 123 | failed: | ||
1566 | 124 | dbus_message_unref(msg); | ||
1567 | 125 | return ret; | ||
1568 | 126 | } | ||
1569 | 127 | |||
1570 | 128 | static struct bluetooth_service *find_service( | ||
1571 | 129 | struct obex_service_driver *driver, | ||
1572 | 130 | uint8_t channel) | ||
1573 | 131 | { | ||
1574 | 132 | GSList *l; | ||
1575 | 133 | |||
1576 | 134 | for (l = any->services; l; l = l->next) { | ||
1577 | 135 | struct bluetooth_service *service = l->data; | ||
1578 | 136 | |||
1579 | 137 | if (driver != NULL && service->driver != driver) | ||
1580 | 138 | continue; | ||
1581 | 139 | |||
1582 | 140 | if (channel != 0 && service->driver->channel != channel) | ||
1583 | 141 | continue; | ||
1584 | 142 | |||
1585 | 143 | return service; | ||
1586 | 144 | } | ||
1587 | 145 | |||
1588 | 146 | return NULL; | ||
1589 | 147 | } | ||
1590 | 148 | |||
1591 | 149 | static void register_record(struct obex_server *server) | ||
1592 | 150 | { | ||
1593 | 151 | const GSList *l; | ||
1594 | 152 | |||
1595 | 153 | if (connection == NULL) | ||
1596 | 154 | return; | ||
1597 | 155 | |||
1598 | 156 | for (l = server->drivers; l; l = l->next) { | ||
1599 | 157 | struct obex_service_driver *driver = l->data; | ||
1600 | 158 | struct bluetooth_service *service; | ||
1601 | 159 | char *xml; | ||
1602 | 160 | |||
1603 | 161 | service = find_service(driver, 0); | ||
1604 | 162 | if (service == NULL) { | ||
1605 | 163 | service = g_new0(struct bluetooth_service, 1); | ||
1606 | 164 | service->driver = driver; | ||
1607 | 165 | service->server = server; | ||
1608 | 166 | any->services = g_slist_append(any->services, service); | ||
1609 | 167 | } | ||
1610 | 168 | |||
1611 | 169 | /* Service already has a record registered */ | ||
1612 | 170 | if (service->handle != 0) | ||
1613 | 171 | continue; | ||
1614 | 172 | |||
1615 | 173 | /* Adapter ANY is not available yet: Add record later */ | ||
1616 | 174 | if (any->path == NULL) | ||
1617 | 175 | continue; | ||
1618 | 176 | |||
1619 | 177 | xml = g_markup_printf_escaped(driver->record, driver->channel, | ||
1620 | 178 | driver->name); | ||
1621 | 179 | add_record(any->path, xml, service); | ||
1622 | 180 | g_free(xml); | ||
1623 | 181 | } | ||
1624 | 182 | } | ||
1625 | 183 | |||
1626 | 184 | static void find_adapter_any_reply(DBusPendingCall *call, void *user_data) | ||
1627 | 185 | { | ||
1628 | 186 | DBusMessage *reply = dbus_pending_call_steal_reply(call); | ||
1629 | 187 | const char *path; | ||
1630 | 188 | GSList *l; | ||
1631 | 189 | DBusError derr; | ||
1632 | 190 | |||
1633 | 191 | dbus_error_init(&derr); | ||
1634 | 192 | if (dbus_set_error_from_message(&derr, reply)) { | ||
1635 | 193 | error("bluetooth: Replied with an error: %s, %s", | ||
1636 | 194 | derr.name, derr.message); | ||
1637 | 195 | dbus_error_free(&derr); | ||
1638 | 196 | goto done; | ||
1639 | 197 | } | ||
1640 | 198 | |||
1641 | 199 | dbus_message_get_args(reply, NULL, | ||
1642 | 200 | DBUS_TYPE_OBJECT_PATH, &path, | ||
1643 | 201 | DBUS_TYPE_INVALID); | ||
1644 | 202 | any->path = g_strdup(path); | ||
1645 | 203 | |||
1646 | 204 | for (l = any->services; l; l = l->next) { | ||
1647 | 205 | struct bluetooth_service *service = l->data; | ||
1648 | 206 | char *xml; | ||
1649 | 207 | |||
1650 | 208 | xml = g_markup_printf_escaped(service->driver->record, | ||
1651 | 209 | service->driver->channel, | ||
1652 | 210 | service->driver->name); | ||
1653 | 211 | add_record(any->path, xml, service); | ||
1654 | 212 | g_free(xml); | ||
1655 | 213 | } | ||
1656 | 214 | |||
1657 | 215 | done: | ||
1658 | 216 | dbus_message_unref(reply); | ||
1659 | 217 | } | ||
1660 | 218 | |||
1661 | 219 | static DBusPendingCall *find_adapter(const char *pattern, | ||
1662 | 220 | DBusPendingCallNotifyFunction function, | ||
1663 | 221 | void *user_data) | ||
1664 | 222 | { | ||
1665 | 223 | DBusMessage *msg; | ||
1666 | 224 | DBusPendingCall *call; | ||
1667 | 225 | |||
1668 | 226 | debug("bluetooth: FindAdapter(%s)", pattern); | ||
1669 | 227 | |||
1670 | 228 | msg = dbus_message_new_method_call("org.bluez", "/", | ||
1671 | 229 | "org.bluez.Manager", "FindAdapter"); | ||
1672 | 230 | if (!msg) | ||
1673 | 231 | return NULL; | ||
1674 | 232 | |||
1675 | 233 | dbus_message_append_args(msg, DBUS_TYPE_STRING, &pattern, | ||
1676 | 234 | DBUS_TYPE_INVALID); | ||
1677 | 235 | |||
1678 | 236 | if (!dbus_connection_send_with_reply(connection, msg, &call, -1)) { | ||
1679 | 237 | dbus_message_unref(msg); | ||
1680 | 238 | return NULL; | ||
1681 | 239 | } | ||
1682 | 240 | |||
1683 | 241 | dbus_pending_call_set_notify(call, function, user_data, NULL); | ||
1684 | 242 | |||
1685 | 243 | dbus_message_unref(msg); | ||
1686 | 244 | |||
1687 | 245 | return call; | ||
1688 | 246 | } | ||
1689 | 247 | |||
1690 | 248 | static void name_acquired(DBusConnection *conn, void *user_data) | ||
1691 | 249 | { | ||
1692 | 250 | DBusPendingCall *call; | ||
1693 | 251 | |||
1694 | 252 | call = find_adapter("any", find_adapter_any_reply, NULL); | ||
1695 | 253 | if (call) | ||
1696 | 254 | dbus_pending_call_unref(call); | ||
1697 | 255 | } | ||
1698 | 256 | |||
1699 | 257 | static void name_released(DBusConnection *conn, void *user_data) | ||
1700 | 258 | { | ||
1701 | 259 | GSList *l; | ||
1702 | 260 | |||
1703 | 261 | /* reset handles so the services got register next time */ | ||
1704 | 262 | for (l = any->services; l; l = l->next) { | ||
1705 | 263 | struct bluetooth_service *service = l->data; | ||
1706 | 264 | |||
1707 | 265 | service->handle = 0; | ||
1708 | 266 | } | ||
1709 | 267 | |||
1710 | 268 | g_free(any->path); | ||
1711 | 269 | any->path = NULL; | ||
1712 | 270 | |||
1713 | 271 | } | ||
1714 | 272 | |||
1715 | 273 | static void service_cancel(struct pending_request *pending) | ||
1716 | 274 | { | ||
1717 | 275 | DBusMessage *msg; | ||
1718 | 276 | |||
1719 | 277 | msg = dbus_message_new_method_call("org.bluez", | ||
1720 | 278 | pending->adapter_path, | ||
1721 | 279 | "org.bluez.Service", | ||
1722 | 280 | "CancelAuthorization"); | ||
1723 | 281 | |||
1724 | 282 | g_dbus_send_message(connection, msg); | ||
1725 | 283 | } | ||
1726 | 284 | |||
1727 | 285 | static void pending_request_free(struct pending_request *pending) | ||
1728 | 286 | { | ||
1729 | 287 | if (pending->call) | ||
1730 | 288 | dbus_pending_call_unref(pending->call); | ||
1731 | 289 | g_io_channel_unref(pending->io); | ||
1732 | 290 | g_free(pending->adapter_path); | ||
1733 | 291 | g_free(pending); | ||
1734 | 292 | } | ||
1735 | 293 | |||
1736 | 294 | static void connect_event(GIOChannel *io, GError *err, void *user_data) | ||
1737 | 295 | { | ||
1738 | 296 | struct bluetooth_service *service = user_data; | ||
1739 | 297 | struct obex_server *server = service->server; | ||
1740 | 298 | |||
1741 | 299 | if (err) | ||
1742 | 300 | goto drop; | ||
1743 | 301 | |||
1744 | 302 | if (obex_server_new_connection(server, io, BT_TX_MTU, BT_RX_MTU) < 0) | ||
1745 | 303 | g_io_channel_shutdown(io, TRUE, NULL); | ||
1746 | 304 | |||
1747 | 305 | return; | ||
1748 | 306 | |||
1749 | 307 | drop: | ||
1750 | 308 | error("%s", err->message); | ||
1751 | 309 | g_io_channel_shutdown(io, TRUE, NULL); | ||
1752 | 310 | return; | ||
1753 | 311 | } | ||
1754 | 312 | |||
1755 | 313 | static void service_reply(DBusPendingCall *call, void *user_data) | ||
1756 | 314 | { | ||
1757 | 315 | struct pending_request *pending = user_data; | ||
1758 | 316 | GIOChannel *io = pending->io; | ||
1759 | 317 | struct bluetooth_service *service = pending->service; | ||
1760 | 318 | DBusMessage *reply = dbus_pending_call_steal_reply(call); | ||
1761 | 319 | DBusError derr; | ||
1762 | 320 | GError *err = NULL; | ||
1763 | 321 | |||
1764 | 322 | dbus_error_init(&derr); | ||
1765 | 323 | if (dbus_set_error_from_message(&derr, reply)) { | ||
1766 | 324 | error("bluetooth: RequestAuthorization error: %s, %s", | ||
1767 | 325 | derr.name, derr.message); | ||
1768 | 326 | |||
1769 | 327 | if (dbus_error_has_name(&derr, DBUS_ERROR_NO_REPLY)) | ||
1770 | 328 | service_cancel(pending); | ||
1771 | 329 | |||
1772 | 330 | dbus_error_free(&derr); | ||
1773 | 331 | g_io_channel_shutdown(io, TRUE, NULL); | ||
1774 | 332 | goto done; | ||
1775 | 333 | } | ||
1776 | 334 | |||
1777 | 335 | debug("bluetooth: RequestAuthorization succeeded"); | ||
1778 | 336 | |||
1779 | 337 | if (!bt_io_accept(io, connect_event, service, NULL, &err)) { | ||
1780 | 338 | error("%s", err->message); | ||
1781 | 339 | g_error_free(err); | ||
1782 | 340 | g_io_channel_shutdown(io, TRUE, NULL); | ||
1783 | 341 | } | ||
1784 | 342 | |||
1785 | 343 | done: | ||
1786 | 344 | g_source_remove(pending->watch); | ||
1787 | 345 | pending_request_free(pending); | ||
1788 | 346 | dbus_message_unref(reply); | ||
1789 | 347 | } | ||
1790 | 348 | |||
1791 | 349 | static gboolean service_error(GIOChannel *io, GIOCondition cond, | ||
1792 | 350 | void *user_data) | ||
1793 | 351 | { | ||
1794 | 352 | struct pending_request *pending = user_data; | ||
1795 | 353 | |||
1796 | 354 | service_cancel(pending); | ||
1797 | 355 | |||
1798 | 356 | dbus_pending_call_cancel(pending->call); | ||
1799 | 357 | |||
1800 | 358 | pending_request_free(pending); | ||
1801 | 359 | |||
1802 | 360 | return FALSE; | ||
1803 | 361 | } | ||
1804 | 362 | |||
1805 | 363 | static void find_adapter_reply(DBusPendingCall *call, void *user_data) | ||
1806 | 364 | { | ||
1807 | 365 | struct pending_request *pending = user_data; | ||
1808 | 366 | DBusMessage *reply = dbus_pending_call_steal_reply(call); | ||
1809 | 367 | DBusMessage *msg; | ||
1810 | 368 | DBusPendingCall *pcall; | ||
1811 | 369 | const char *path, *paddr = pending->address; | ||
1812 | 370 | DBusError derr; | ||
1813 | 371 | |||
1814 | 372 | dbus_error_init(&derr); | ||
1815 | 373 | if (dbus_set_error_from_message(&derr, reply)) { | ||
1816 | 374 | error("Replied with an error: %s, %s", | ||
1817 | 375 | derr.name, derr.message); | ||
1818 | 376 | dbus_error_free(&derr); | ||
1819 | 377 | goto failed; | ||
1820 | 378 | } | ||
1821 | 379 | |||
1822 | 380 | dbus_message_get_args(reply, NULL, | ||
1823 | 381 | DBUS_TYPE_OBJECT_PATH, &path, | ||
1824 | 382 | DBUS_TYPE_INVALID); | ||
1825 | 383 | |||
1826 | 384 | debug("bluetooth: FindAdapter -> %s", path); | ||
1827 | 385 | pending->adapter_path = g_strdup(path); | ||
1828 | 386 | dbus_message_unref(reply); | ||
1829 | 387 | |||
1830 | 388 | msg = dbus_message_new_method_call("org.bluez", path, | ||
1831 | 389 | "org.bluez.Service", "RequestAuthorization"); | ||
1832 | 390 | |||
1833 | 391 | dbus_message_append_args(msg, DBUS_TYPE_STRING, &paddr, | ||
1834 | 392 | DBUS_TYPE_UINT32, &pending->service->handle, | ||
1835 | 393 | DBUS_TYPE_INVALID); | ||
1836 | 394 | |||
1837 | 395 | if (!dbus_connection_send_with_reply(connection, | ||
1838 | 396 | msg, &pcall, TIMEOUT)) { | ||
1839 | 397 | dbus_message_unref(msg); | ||
1840 | 398 | goto failed; | ||
1841 | 399 | } | ||
1842 | 400 | |||
1843 | 401 | dbus_message_unref(msg); | ||
1844 | 402 | |||
1845 | 403 | debug("bluetooth: RequestAuthorization(%s, %x)", paddr, | ||
1846 | 404 | pending->service->handle); | ||
1847 | 405 | |||
1848 | 406 | if (!dbus_pending_call_set_notify(pcall, service_reply, pending, | ||
1849 | 407 | NULL)) { | ||
1850 | 408 | dbus_pending_call_unref(pcall); | ||
1851 | 409 | goto failed; | ||
1852 | 410 | } | ||
1853 | 411 | |||
1854 | 412 | dbus_pending_call_unref(pending->call); | ||
1855 | 413 | pending->call = pcall; | ||
1856 | 414 | |||
1857 | 415 | /* Catches errors before authorization response comes */ | ||
1858 | 416 | pending->watch = g_io_add_watch(pending->io, | ||
1859 | 417 | G_IO_HUP | G_IO_ERR | G_IO_NVAL, | ||
1860 | 418 | service_error, pending); | ||
1861 | 419 | |||
1862 | 420 | return; | ||
1863 | 421 | |||
1864 | 422 | failed: | ||
1865 | 423 | g_io_channel_shutdown(pending->io, TRUE, NULL); | ||
1866 | 424 | pending_request_free(pending); | ||
1867 | 425 | } | ||
1868 | 426 | |||
1869 | 427 | static int request_service_authorization(struct bluetooth_service *service, | ||
1870 | 428 | GIOChannel *io, const char *address) | ||
1871 | 429 | { | ||
1872 | 430 | struct pending_request *pending; | ||
1873 | 431 | char source[18]; | ||
1874 | 432 | GError *err = NULL; | ||
1875 | 433 | |||
1876 | 434 | if (connection == NULL || any->path == NULL) | ||
1877 | 435 | return -1; | ||
1878 | 436 | |||
1879 | 437 | bt_io_get(io, BT_IO_RFCOMM, &err, | ||
1880 | 438 | BT_IO_OPT_SOURCE, source, | ||
1881 | 439 | BT_IO_OPT_INVALID); | ||
1882 | 440 | if (err) { | ||
1883 | 441 | error("%s", err->message); | ||
1884 | 442 | g_error_free(err); | ||
1885 | 443 | return -EINVAL; | ||
1886 | 444 | } | ||
1887 | 445 | |||
1888 | 446 | pending = g_new0(struct pending_request, 1); | ||
1889 | 447 | pending->call = find_adapter(source, find_adapter_reply, pending); | ||
1890 | 448 | if (!pending->call) { | ||
1891 | 449 | g_free(pending); | ||
1892 | 450 | return -ENOMEM; | ||
1893 | 451 | } | ||
1894 | 452 | |||
1895 | 453 | pending->service = service; | ||
1896 | 454 | pending->io = g_io_channel_ref(io); | ||
1897 | 455 | memcpy(pending->address, address, sizeof(pending->address)); | ||
1898 | 456 | |||
1899 | 457 | return 0; | ||
1900 | 458 | } | ||
1901 | 459 | |||
1902 | 460 | static void confirm_event(GIOChannel *io, void *user_data) | ||
1903 | 461 | { | ||
1904 | 462 | struct bluetooth_service *service; | ||
1905 | 463 | GError *err = NULL; | ||
1906 | 464 | char address[18]; | ||
1907 | 465 | uint8_t channel; | ||
1908 | 466 | |||
1909 | 467 | bt_io_get(io, BT_IO_RFCOMM, &err, | ||
1910 | 468 | BT_IO_OPT_DEST, address, | ||
1911 | 469 | BT_IO_OPT_CHANNEL, &channel, | ||
1912 | 470 | BT_IO_OPT_INVALID); | ||
1913 | 471 | if (err) { | ||
1914 | 472 | error("%s", err->message); | ||
1915 | 473 | g_error_free(err); | ||
1916 | 474 | goto drop; | ||
1917 | 475 | } | ||
1918 | 476 | |||
1919 | 477 | info("bluetooth: New connection from: %s, channel %u", address, | ||
1920 | 478 | channel); | ||
1921 | 479 | |||
1922 | 480 | service = find_service(NULL, channel); | ||
1923 | 481 | if (service == NULL) { | ||
1924 | 482 | error("bluetooth: Unable to find service"); | ||
1925 | 483 | goto drop; | ||
1926 | 484 | } | ||
1927 | 485 | |||
1928 | 486 | if (service->driver->service != OBEX_OPP) { | ||
1929 | 487 | if (request_service_authorization(service, io, address) < 0) | ||
1930 | 488 | goto drop; | ||
1931 | 489 | |||
1932 | 490 | return; | ||
1933 | 491 | } | ||
1934 | 492 | |||
1935 | 493 | if (!bt_io_accept(io, connect_event, service, NULL, &err)) { | ||
1936 | 494 | error("%s", err->message); | ||
1937 | 495 | g_error_free(err); | ||
1938 | 496 | goto drop; | ||
1939 | 497 | } | ||
1940 | 498 | |||
1941 | 499 | return; | ||
1942 | 500 | |||
1943 | 501 | drop: | ||
1944 | 502 | g_io_channel_shutdown(io, TRUE, NULL); | ||
1945 | 503 | } | ||
1946 | 504 | |||
1947 | 505 | static GIOChannel *start(struct obex_server *server, | ||
1948 | 506 | struct obex_service_driver *service, | ||
1949 | 507 | BtIOSecLevel sec_level) | ||
1950 | 508 | { | ||
1951 | 509 | GIOChannel *io; | ||
1952 | 510 | GError *err = NULL; | ||
1953 | 511 | |||
1954 | 512 | io = bt_io_listen(BT_IO_RFCOMM, NULL, confirm_event, | ||
1955 | 513 | server, NULL, &err, | ||
1956 | 514 | BT_IO_OPT_CHANNEL, service->channel, | ||
1957 | 515 | BT_IO_OPT_SEC_LEVEL, sec_level, | ||
1958 | 516 | BT_IO_OPT_INVALID); | ||
1959 | 517 | if (io == NULL) { | ||
1960 | 518 | error("bluetooth: unable to listen in channel %d: %s", | ||
1961 | 519 | service->channel, err->message); | ||
1962 | 520 | g_error_free(err); | ||
1963 | 521 | } else | ||
1964 | 522 | debug("bluetooth: listening on channel %d", service->channel); | ||
1965 | 523 | |||
1966 | 524 | return io; | ||
1967 | 525 | } | ||
1968 | 526 | |||
1969 | 527 | static void *bluetooth_start(struct obex_server *server, int *err) | ||
1970 | 528 | { | ||
1971 | 529 | BtIOSecLevel sec_level; | ||
1972 | 530 | GSList *ios = NULL; | ||
1973 | 531 | const GSList *l; | ||
1974 | 532 | |||
1975 | 533 | if (server->secure == TRUE) | ||
1976 | 534 | sec_level = BT_IO_SEC_MEDIUM; | ||
1977 | 535 | else | ||
1978 | 536 | sec_level = BT_IO_SEC_LOW; | ||
1979 | 537 | |||
1980 | 538 | for (l = server->drivers; l; l = l->next) { | ||
1981 | 539 | struct obex_service_driver *service = l->data; | ||
1982 | 540 | GIOChannel *io; | ||
1983 | 541 | |||
1984 | 542 | io = start(server, service, sec_level); | ||
1985 | 543 | if (io == NULL) | ||
1986 | 544 | continue; | ||
1987 | 545 | |||
1988 | 546 | ios = g_slist_prepend(ios, io); | ||
1989 | 547 | } | ||
1990 | 548 | |||
1991 | 549 | register_record(server); | ||
1992 | 550 | |||
1993 | 551 | return ios; | ||
1994 | 552 | } | ||
1995 | 553 | |||
1996 | 554 | static void stop(gpointer data, gpointer user_data) | ||
1997 | 555 | { | ||
1998 | 556 | GIOChannel *io = data; | ||
1999 | 557 | |||
2000 | 558 | g_io_channel_shutdown(io, TRUE, NULL); | ||
2001 | 559 | g_io_channel_unref(io); | ||
2002 | 560 | } | ||
2003 | 561 | |||
2004 | 562 | static void bluetooth_stop(void *data) | ||
2005 | 563 | { | ||
2006 | 564 | GSList *ios = data; | ||
2007 | 565 | |||
2008 | 566 | g_slist_foreach(ios, stop, NULL); | ||
2009 | 567 | g_slist_free(ios); | ||
2010 | 568 | } | ||
2011 | 569 | |||
2012 | 570 | static struct obex_transport_driver driver = { | ||
2013 | 571 | .name = "bluetooth", | ||
2014 | 572 | .start = bluetooth_start, | ||
2015 | 573 | .stop = bluetooth_stop | ||
2016 | 574 | }; | ||
2017 | 575 | |||
2018 | 576 | static unsigned int listener_id = 0; | ||
2019 | 577 | |||
2020 | 578 | static int bluetooth_init(void) | ||
2021 | 579 | { | ||
2022 | 580 | any = g_new0(struct adapter_any, 1); | ||
2023 | 581 | |||
2024 | 582 | connection = g_dbus_setup_private(DBUS_BUS_SYSTEM, NULL, NULL); | ||
2025 | 583 | if (connection == NULL) | ||
2026 | 584 | return -EPERM; | ||
2027 | 585 | |||
2028 | 586 | listener_id = g_dbus_add_service_watch(connection, "org.bluez", | ||
2029 | 587 | name_acquired, name_released, NULL, NULL); | ||
2030 | 588 | |||
2031 | 589 | return obex_transport_driver_register(&driver); | ||
2032 | 590 | } | ||
2033 | 591 | |||
2034 | 592 | static void bluetooth_exit(void) | ||
2035 | 593 | { | ||
2036 | 594 | g_dbus_remove_watch(connection, listener_id); | ||
2037 | 595 | |||
2038 | 596 | if (any) { | ||
2039 | 597 | g_slist_foreach(any->services, (GFunc) g_free, NULL); | ||
2040 | 598 | g_slist_free(any->services); | ||
2041 | 599 | g_free(any->path); | ||
2042 | 600 | g_free(any); | ||
2043 | 601 | } | ||
2044 | 602 | |||
2045 | 603 | if (connection) | ||
2046 | 604 | dbus_connection_unref(connection); | ||
2047 | 605 | |||
2048 | 606 | obex_transport_driver_unregister(&driver); | ||
2049 | 607 | } | ||
2050 | 608 | |||
2051 | 609 | OBEX_PLUGIN_DEFINE(bluetooth, bluetooth_init, bluetooth_exit) | ||
2052 | 0 | 610 | ||
2053 | === modified file 'plugins/filesystem.c' | |||
2054 | --- plugins/filesystem.c 2010-04-27 04:17:15 +0000 | |||
2055 | +++ plugins/filesystem.c 2010-06-15 19:18:33 +0000 | |||
2056 | @@ -58,7 +58,7 @@ | |||
2057 | 58 | #define FL_TYPE "<!DOCTYPE folder-listing SYSTEM \"obex-folder-listing.dtd\">" EOL_CHARS | 58 | #define FL_TYPE "<!DOCTYPE folder-listing SYSTEM \"obex-folder-listing.dtd\">" EOL_CHARS |
2058 | 59 | 59 | ||
2059 | 60 | #define FL_TYPE_PCSUITE "<!DOCTYPE folder-listing SYSTEM \"obex-folder-listing.dtd\"" EOL_CHARS \ | 60 | #define FL_TYPE_PCSUITE "<!DOCTYPE folder-listing SYSTEM \"obex-folder-listing.dtd\"" EOL_CHARS \ |
2061 | 61 | " [ <!ATTLIST folder mem-type CDATA #IMPLIED> ]>" EOL_CHARS | 61 | " [ <!ATTLIST folder mem-type CDATA #IMPLIED> ]>" EOL_CHARS |
2062 | 62 | 62 | ||
2063 | 63 | #define FL_BODY_BEGIN "<folder-listing version=\"1.0\">" EOL_CHARS | 63 | #define FL_BODY_BEGIN "<folder-listing version=\"1.0\">" EOL_CHARS |
2064 | 64 | 64 | ||
2065 | @@ -77,16 +77,22 @@ | |||
2066 | 77 | " modified=\"%s\" mem-type=\"DEV\"" \ | 77 | " modified=\"%s\" mem-type=\"DEV\"" \ |
2067 | 78 | " created=\"%s\"/>" EOL_CHARS | 78 | " created=\"%s\"/>" EOL_CHARS |
2068 | 79 | 79 | ||
2070 | 80 | static const guint8 FTP_TARGET[TARGET_SIZE] = { | 80 | static const uint8_t FTP_TARGET[TARGET_SIZE] = { |
2071 | 81 | 0xF9, 0xEC, 0x7B, 0xC4, 0x95, 0x3C, 0x11, 0xD2, | 81 | 0xF9, 0xEC, 0x7B, 0xC4, 0x95, 0x3C, 0x11, 0xD2, |
2072 | 82 | 0x98, 0x4E, 0x52, 0x54, 0x00, 0xDC, 0x9E, 0x09 }; | 82 | 0x98, 0x4E, 0x52, 0x54, 0x00, 0xDC, 0x9E, 0x09 }; |
2073 | 83 | 83 | ||
2077 | 84 | static gchar *file_stat_line(gchar *filename, struct stat *fstat, | 84 | #define PCSUITE_WHO_SIZE 8 |
2078 | 85 | struct stat *dstat, gboolean root, | 85 | |
2079 | 86 | gboolean pcsuite) | 86 | static const uint8_t PCSUITE_WHO[PCSUITE_WHO_SIZE] = { |
2080 | 87 | 'P','C',' ','S','u','i','t','e' }; | ||
2081 | 88 | |||
2082 | 89 | |||
2083 | 90 | static char *file_stat_line(char *filename, struct stat *fstat, | ||
2084 | 91 | struct stat *dstat, gboolean root, | ||
2085 | 92 | gboolean pcsuite) | ||
2086 | 87 | { | 93 | { |
2089 | 88 | gchar perm[51], atime[18], ctime[18], mtime[18]; | 94 | char perm[51], atime[18], ctime[18], mtime[18]; |
2090 | 89 | gchar *escaped, *ret = NULL; | 95 | char *escaped, *ret = NULL; |
2091 | 90 | 96 | ||
2092 | 91 | snprintf(perm, 50, "user-perm=\"%s%s%s\" group-perm=\"%s%s%s\" " | 97 | snprintf(perm, 50, "user-perm=\"%s%s%s\" group-perm=\"%s%s%s\" " |
2093 | 92 | "other-perm=\"%s%s%s\"", | 98 | "other-perm=\"%s%s%s\"", |
2094 | @@ -113,22 +119,26 @@ | |||
2095 | 113 | mtime, ctime); | 119 | mtime, ctime); |
2096 | 114 | else | 120 | else |
2097 | 115 | ret = g_strdup_printf(FL_FOLDER_ELEMENT, escaped, perm, | 121 | ret = g_strdup_printf(FL_FOLDER_ELEMENT, escaped, perm, |
2099 | 116 | atime, mtime, ctime); | 122 | atime, mtime, ctime); |
2100 | 117 | } else if (S_ISREG(fstat->st_mode)) | 123 | } else if (S_ISREG(fstat->st_mode)) |
2101 | 118 | ret = g_strdup_printf(FL_FILE_ELEMENT, escaped, fstat->st_size, | 124 | ret = g_strdup_printf(FL_FILE_ELEMENT, escaped, fstat->st_size, |
2103 | 119 | perm, atime, mtime, ctime); | 125 | perm, atime, mtime, ctime); |
2104 | 120 | 126 | ||
2105 | 121 | g_free(escaped); | 127 | g_free(escaped); |
2106 | 122 | 128 | ||
2107 | 123 | return ret; | 129 | return ret; |
2108 | 124 | } | 130 | } |
2109 | 125 | 131 | ||
2112 | 126 | static gpointer filesystem_open(const char *name, int oflag, mode_t mode, | 132 | static void *filesystem_open(const char *name, int oflag, mode_t mode, |
2113 | 127 | gpointer context, size_t *size, int *err) | 133 | void *context, size_t *size, int *err) |
2114 | 128 | { | 134 | { |
2115 | 129 | struct stat stats; | 135 | struct stat stats; |
2116 | 130 | struct statvfs buf; | 136 | struct statvfs buf; |
2117 | 137 | const char *root_folder; | ||
2118 | 138 | char *folder; | ||
2119 | 139 | gboolean root; | ||
2120 | 131 | int fd = open(name, oflag, mode); | 140 | int fd = open(name, oflag, mode); |
2121 | 141 | uint64_t avail; | ||
2122 | 132 | 142 | ||
2123 | 133 | if (fd < 0) { | 143 | if (fd < 0) { |
2124 | 134 | if (err) | 144 | if (err) |
2125 | @@ -142,6 +152,21 @@ | |||
2126 | 142 | goto failed; | 152 | goto failed; |
2127 | 143 | } | 153 | } |
2128 | 144 | 154 | ||
2129 | 155 | root_folder = obex_option_root_folder(); | ||
2130 | 156 | folder = g_path_get_dirname(name); | ||
2131 | 157 | root = g_strcmp0(folder, root_folder); | ||
2132 | 158 | |||
2133 | 159 | g_free(folder); | ||
2134 | 160 | |||
2135 | 161 | if (!root || obex_option_symlinks()) { | ||
2136 | 162 | if (S_ISLNK(stats.st_mode)) { | ||
2137 | 163 | if (err) | ||
2138 | 164 | *err = -EPERM; | ||
2139 | 165 | goto failed; | ||
2140 | 166 | } | ||
2141 | 167 | |||
2142 | 168 | } | ||
2143 | 169 | |||
2144 | 145 | if (oflag == O_RDONLY) { | 170 | if (oflag == O_RDONLY) { |
2145 | 146 | if (size) | 171 | if (size) |
2146 | 147 | *size = stats.st_size; | 172 | *size = stats.st_size; |
2147 | @@ -157,7 +182,8 @@ | |||
2148 | 157 | if (size == NULL) | 182 | if (size == NULL) |
2149 | 158 | goto done; | 183 | goto done; |
2150 | 159 | 184 | ||
2152 | 160 | if (buf.f_bsize * buf.f_bavail < *size) { | 185 | avail = (uint64_t) buf.f_bsize * buf.f_bavail; |
2153 | 186 | if (avail < *size) { | ||
2154 | 161 | if (err) | 187 | if (err) |
2155 | 162 | *err = -ENOSPC; | 188 | *err = -ENOSPC; |
2156 | 163 | goto failed; | 189 | goto failed; |
2157 | @@ -174,7 +200,7 @@ | |||
2158 | 174 | return NULL; | 200 | return NULL; |
2159 | 175 | } | 201 | } |
2160 | 176 | 202 | ||
2162 | 177 | static int filesystem_close(gpointer object) | 203 | static int filesystem_close(void *object) |
2163 | 178 | { | 204 | { |
2164 | 179 | if (close(GPOINTER_TO_INT(object)) < 0) | 205 | if (close(GPOINTER_TO_INT(object)) < 0) |
2165 | 180 | return -errno; | 206 | return -errno; |
2166 | @@ -182,7 +208,8 @@ | |||
2167 | 182 | return 0; | 208 | return 0; |
2168 | 183 | } | 209 | } |
2169 | 184 | 210 | ||
2171 | 185 | static ssize_t filesystem_read(gpointer object, void *buf, size_t count) | 211 | static ssize_t filesystem_read(void *object, void *buf, size_t count, |
2172 | 212 | uint8_t *hi) | ||
2173 | 186 | { | 213 | { |
2174 | 187 | ssize_t ret; | 214 | ssize_t ret; |
2175 | 188 | 215 | ||
2176 | @@ -190,10 +217,12 @@ | |||
2177 | 190 | if (ret < 0) | 217 | if (ret < 0) |
2178 | 191 | return -errno; | 218 | return -errno; |
2179 | 192 | 219 | ||
2180 | 220 | *hi = OBEX_HDR_BODY; | ||
2181 | 221 | |||
2182 | 193 | return ret; | 222 | return ret; |
2183 | 194 | } | 223 | } |
2184 | 195 | 224 | ||
2186 | 196 | static ssize_t filesystem_write(gpointer object, const void *buf, size_t count) | 225 | static ssize_t filesystem_write(void *object, const void *buf, size_t count) |
2187 | 197 | { | 226 | { |
2188 | 198 | ssize_t ret; | 227 | ssize_t ret; |
2189 | 199 | 228 | ||
2190 | @@ -208,11 +237,11 @@ | |||
2191 | 208 | int pid; | 237 | int pid; |
2192 | 209 | int output; | 238 | int output; |
2193 | 210 | int err; | 239 | int err; |
2195 | 211 | guint watch; | 240 | unsigned int watch; |
2196 | 212 | GString *buffer; | 241 | GString *buffer; |
2197 | 213 | }; | 242 | }; |
2198 | 214 | 243 | ||
2200 | 215 | static void script_exited(GPid pid, gint status, gpointer data) | 244 | static void script_exited(GPid pid, int status, void *data) |
2201 | 216 | { | 245 | { |
2202 | 217 | struct capability_object *object = data; | 246 | struct capability_object *object = data; |
2203 | 218 | char buf[128]; | 247 | char buf[128]; |
2204 | @@ -246,11 +275,11 @@ | |||
2205 | 246 | return pid; | 275 | return pid; |
2206 | 247 | } | 276 | } |
2207 | 248 | 277 | ||
2210 | 249 | static gpointer capability_open(const char *name, int oflag, mode_t mode, | 278 | static void *capability_open(const char *name, int oflag, mode_t mode, |
2211 | 250 | gpointer context, size_t *size, int *err) | 279 | void *context, size_t *size, int *err) |
2212 | 251 | { | 280 | { |
2213 | 252 | struct capability_object *object = NULL; | 281 | struct capability_object *object = NULL; |
2215 | 253 | gchar *buf; | 282 | char *buf; |
2216 | 254 | const char *argv[2]; | 283 | const char *argv[2]; |
2217 | 255 | 284 | ||
2218 | 256 | if (oflag != O_RDONLY) | 285 | if (oflag != O_RDONLY) |
2219 | @@ -306,25 +335,26 @@ | |||
2220 | 306 | return NULL; | 335 | return NULL; |
2221 | 307 | } | 336 | } |
2222 | 308 | 337 | ||
2227 | 309 | static gpointer folder_open(const char *name, int oflag, mode_t mode, | 338 | static GString *append_pcsuite_preamble(GString *object) |
2228 | 310 | gpointer context, size_t *size, int *err) | 339 | { |
2229 | 311 | { | 340 | return g_string_append(object, FL_TYPE_PCSUITE); |
2230 | 312 | struct obex_session *os = context; | 341 | } |
2231 | 342 | |||
2232 | 343 | static GString *append_folder_preamble(GString *object) | ||
2233 | 344 | { | ||
2234 | 345 | return g_string_append(object, FL_TYPE); | ||
2235 | 346 | } | ||
2236 | 347 | |||
2237 | 348 | static GString *append_listing(GString *object, const char *name, | ||
2238 | 349 | gboolean pcsuite, size_t *size, int *err) | ||
2239 | 350 | { | ||
2240 | 313 | struct stat fstat, dstat; | 351 | struct stat fstat, dstat; |
2241 | 314 | struct dirent *ep; | 352 | struct dirent *ep; |
2242 | 315 | GString *object; | ||
2243 | 316 | DIR *dp; | 353 | DIR *dp; |
2255 | 317 | gboolean root, pcsuite, symlinks; | 354 | gboolean root, symlinks; |
2256 | 318 | gint ret; | 355 | int ret; |
2257 | 319 | 356 | ||
2258 | 320 | pcsuite = obex_get_service(os) & OBEX_PCSUITE ? TRUE : FALSE; | 357 | root = g_str_equal(name, obex_option_root_folder()); |
2248 | 321 | |||
2249 | 322 | object = g_string_new(FL_VERSION); | ||
2250 | 323 | object = g_string_append(object, pcsuite ? FL_TYPE_PCSUITE : FL_TYPE); | ||
2251 | 324 | |||
2252 | 325 | object = g_string_append(object, FL_BODY_BEGIN); | ||
2253 | 326 | |||
2254 | 327 | root = g_str_equal(name, obex_get_root_folder(os)); | ||
2259 | 328 | 358 | ||
2260 | 329 | dp = opendir(name); | 359 | dp = opendir(name); |
2261 | 330 | if (dp == NULL) { | 360 | if (dp == NULL) { |
2262 | @@ -333,7 +363,7 @@ | |||
2263 | 333 | goto failed; | 363 | goto failed; |
2264 | 334 | } | 364 | } |
2265 | 335 | 365 | ||
2267 | 336 | symlinks = obex_get_symlinks(os); | 366 | symlinks = obex_option_symlinks(); |
2268 | 337 | if (root && symlinks) | 367 | if (root && symlinks) |
2269 | 338 | ret = stat(name, &dstat); | 368 | ret = stat(name, &dstat); |
2270 | 339 | else { | 369 | else { |
2271 | @@ -348,9 +378,9 @@ | |||
2272 | 348 | } | 378 | } |
2273 | 349 | 379 | ||
2274 | 350 | while ((ep = readdir(dp))) { | 380 | while ((ep = readdir(dp))) { |
2278 | 351 | gchar *filename; | 381 | char *filename; |
2279 | 352 | gchar *fullname; | 382 | char *fullname; |
2280 | 353 | gchar *line; | 383 | char *line; |
2281 | 354 | 384 | ||
2282 | 355 | if (ep->d_name[0] == '.') | 385 | if (ep->d_name[0] == '.') |
2283 | 356 | continue; | 386 | continue; |
2284 | @@ -378,7 +408,7 @@ | |||
2285 | 378 | 408 | ||
2286 | 379 | g_free(fullname); | 409 | g_free(fullname); |
2287 | 380 | 410 | ||
2289 | 381 | line = file_stat_line(filename, &fstat, &dstat, root, pcsuite); | 411 | line = file_stat_line(filename, &fstat, &dstat, root, FALSE); |
2290 | 382 | if (line == NULL) { | 412 | if (line == NULL) { |
2291 | 383 | g_free(filename); | 413 | g_free(filename); |
2292 | 384 | continue; | 414 | continue; |
2293 | @@ -409,7 +439,31 @@ | |||
2294 | 409 | return NULL; | 439 | return NULL; |
2295 | 410 | } | 440 | } |
2296 | 411 | 441 | ||
2298 | 412 | int string_free(gpointer object) | 442 | static void *folder_open(const char *name, int oflag, mode_t mode, |
2299 | 443 | void *context, size_t *size, int *err) | ||
2300 | 444 | { | ||
2301 | 445 | GString *object; | ||
2302 | 446 | |||
2303 | 447 | object = g_string_new(FL_VERSION); | ||
2304 | 448 | object = append_folder_preamble(object); | ||
2305 | 449 | object = g_string_append(object, FL_BODY_BEGIN); | ||
2306 | 450 | |||
2307 | 451 | return append_listing(object, name, FALSE, size, err); | ||
2308 | 452 | } | ||
2309 | 453 | |||
2310 | 454 | static void *pcsuite_open(const char *name, int oflag, mode_t mode, | ||
2311 | 455 | void *context, size_t *size, int *err) | ||
2312 | 456 | { | ||
2313 | 457 | GString *object; | ||
2314 | 458 | |||
2315 | 459 | object = g_string_new(FL_VERSION); | ||
2316 | 460 | object = append_pcsuite_preamble(object); | ||
2317 | 461 | object = g_string_append(object, FL_BODY_BEGIN); | ||
2318 | 462 | |||
2319 | 463 | return append_listing(object, name, TRUE, size, err); | ||
2320 | 464 | } | ||
2321 | 465 | |||
2322 | 466 | int string_free(void *object) | ||
2323 | 413 | { | 467 | { |
2324 | 414 | GString *string = object; | 468 | GString *string = object; |
2325 | 415 | 469 | ||
2326 | @@ -418,7 +472,7 @@ | |||
2327 | 418 | return 0; | 472 | return 0; |
2328 | 419 | } | 473 | } |
2329 | 420 | 474 | ||
2331 | 421 | ssize_t string_read(gpointer object, void *buf, size_t count) | 475 | ssize_t string_read(void *object, void *buf, size_t count) |
2332 | 422 | { | 476 | { |
2333 | 423 | GString *string = object; | 477 | GString *string = object; |
2334 | 424 | ssize_t len; | 478 | ssize_t len; |
2335 | @@ -433,10 +487,19 @@ | |||
2336 | 433 | return len; | 487 | return len; |
2337 | 434 | } | 488 | } |
2338 | 435 | 489 | ||
2340 | 436 | static ssize_t capability_read(gpointer object, void *buf, size_t count) | 490 | static ssize_t folder_read(void *object, void *buf, size_t count, uint8_t *hi) |
2341 | 491 | { | ||
2342 | 492 | *hi = OBEX_HDR_BODY; | ||
2343 | 493 | return string_read(object, buf, count); | ||
2344 | 494 | } | ||
2345 | 495 | |||
2346 | 496 | static ssize_t capability_read(void *object, void *buf, size_t count, | ||
2347 | 497 | uint8_t *hi) | ||
2348 | 437 | { | 498 | { |
2349 | 438 | struct capability_object *obj = object; | 499 | struct capability_object *obj = object; |
2350 | 439 | 500 | ||
2351 | 501 | *hi = OBEX_HDR_BODY; | ||
2352 | 502 | |||
2353 | 440 | if (obj->buffer) | 503 | if (obj->buffer) |
2354 | 441 | return string_read(obj->buffer, buf, count); | 504 | return string_read(obj->buffer, buf, count); |
2355 | 442 | 505 | ||
2356 | @@ -446,7 +509,7 @@ | |||
2357 | 446 | return read(obj->output, buf, count); | 509 | return read(obj->output, buf, count); |
2358 | 447 | } | 510 | } |
2359 | 448 | 511 | ||
2361 | 449 | static int capability_close(gpointer object) | 512 | static int capability_close(void *object) |
2362 | 450 | { | 513 | { |
2363 | 451 | struct capability_object *obj = object; | 514 | struct capability_object *obj = object; |
2364 | 452 | 515 | ||
2365 | @@ -464,7 +527,7 @@ | |||
2366 | 464 | return 0; | 527 | return 0; |
2367 | 465 | } | 528 | } |
2368 | 466 | 529 | ||
2370 | 467 | struct obex_mime_type_driver file = { | 530 | static struct obex_mime_type_driver file = { |
2371 | 468 | .open = filesystem_open, | 531 | .open = filesystem_open, |
2372 | 469 | .close = filesystem_close, | 532 | .close = filesystem_close, |
2373 | 470 | .read = filesystem_read, | 533 | .read = filesystem_read, |
2374 | @@ -472,7 +535,7 @@ | |||
2375 | 472 | .remove = remove, | 535 | .remove = remove, |
2376 | 473 | }; | 536 | }; |
2377 | 474 | 537 | ||
2379 | 475 | struct obex_mime_type_driver capability = { | 538 | static struct obex_mime_type_driver capability = { |
2380 | 476 | .target = FTP_TARGET, | 539 | .target = FTP_TARGET, |
2381 | 477 | .mimetype = "x-obex/capability", | 540 | .mimetype = "x-obex/capability", |
2382 | 478 | .open = capability_open, | 541 | .open = capability_open, |
2383 | @@ -480,12 +543,22 @@ | |||
2384 | 480 | .read = capability_read, | 543 | .read = capability_read, |
2385 | 481 | }; | 544 | }; |
2386 | 482 | 545 | ||
2388 | 483 | struct obex_mime_type_driver folder = { | 546 | static struct obex_mime_type_driver folder = { |
2389 | 484 | .target = FTP_TARGET, | 547 | .target = FTP_TARGET, |
2390 | 485 | .mimetype = "x-obex/folder-listing", | 548 | .mimetype = "x-obex/folder-listing", |
2391 | 486 | .open = folder_open, | 549 | .open = folder_open, |
2392 | 487 | .close = string_free, | 550 | .close = string_free, |
2394 | 488 | .read = string_read, | 551 | .read = folder_read, |
2395 | 552 | }; | ||
2396 | 553 | |||
2397 | 554 | static struct obex_mime_type_driver pcsuite = { | ||
2398 | 555 | .target = FTP_TARGET, | ||
2399 | 556 | .who = PCSUITE_WHO, | ||
2400 | 557 | .who_size = PCSUITE_WHO_SIZE, | ||
2401 | 558 | .mimetype = "x-obex/folder-listing", | ||
2402 | 559 | .open = pcsuite_open, | ||
2403 | 560 | .close = string_free, | ||
2404 | 561 | .read = folder_read, | ||
2405 | 489 | }; | 562 | }; |
2406 | 490 | 563 | ||
2407 | 491 | static int filesystem_init(void) | 564 | static int filesystem_init(void) |
2408 | @@ -500,6 +573,10 @@ | |||
2409 | 500 | if (err < 0) | 573 | if (err < 0) |
2410 | 501 | return err; | 574 | return err; |
2411 | 502 | 575 | ||
2412 | 576 | err = obex_mime_type_driver_register(&pcsuite); | ||
2413 | 577 | if (err < 0) | ||
2414 | 578 | return err; | ||
2415 | 579 | |||
2416 | 503 | return obex_mime_type_driver_register(&file); | 580 | return obex_mime_type_driver_register(&file); |
2417 | 504 | } | 581 | } |
2418 | 505 | 582 | ||
2419 | 506 | 583 | ||
2420 | === modified file 'plugins/filesystem.h' | |||
2421 | --- plugins/filesystem.h 2010-04-27 04:17:15 +0000 | |||
2422 | +++ plugins/filesystem.h 2010-06-15 19:18:33 +0000 | |||
2423 | @@ -21,5 +21,5 @@ | |||
2424 | 21 | * | 21 | * |
2425 | 22 | */ | 22 | */ |
2426 | 23 | 23 | ||
2429 | 24 | int string_free(gpointer object); | 24 | int string_free(void *object); |
2430 | 25 | ssize_t string_read(gpointer object, void *buf, size_t count); | 25 | ssize_t string_read(void *object, void *buf, size_t count); |
2431 | 26 | 26 | ||
2432 | === modified file 'plugins/ftp.c' | |||
2433 | --- plugins/ftp.c 2010-04-27 04:17:15 +0000 | |||
2434 | +++ plugins/ftp.c 2010-06-15 19:18:33 +0000 | |||
2435 | @@ -54,99 +54,100 @@ | |||
2436 | 54 | #define LST_TYPE "x-obex/folder-listing" | 54 | #define LST_TYPE "x-obex/folder-listing" |
2437 | 55 | #define CAP_TYPE "x-obex/capability" | 55 | #define CAP_TYPE "x-obex/capability" |
2438 | 56 | 56 | ||
2475 | 57 | #define FTP_CHANNEL 10 | 57 | #define FTP_CHANNEL 10 |
2476 | 58 | #define FTP_RECORD "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \ | 58 | #define FTP_RECORD "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \ |
2477 | 59 | <record> \ | 59 | <record> \ |
2478 | 60 | <attribute id=\"0x0001\"> \ | 60 | <attribute id=\"0x0001\"> \ |
2479 | 61 | <sequence> \ | 61 | <sequence> \ |
2480 | 62 | <uuid value=\"0x1106\"/> \ | 62 | <uuid value=\"0x1106\"/> \ |
2481 | 63 | </sequence> \ | 63 | </sequence> \ |
2482 | 64 | </attribute> \ | 64 | </attribute> \ |
2483 | 65 | \ | 65 | \ |
2484 | 66 | <attribute id=\"0x0004\"> \ | 66 | <attribute id=\"0x0004\"> \ |
2485 | 67 | <sequence> \ | 67 | <sequence> \ |
2486 | 68 | <sequence> \ | 68 | <sequence> \ |
2487 | 69 | <uuid value=\"0x0100\"/> \ | 69 | <uuid value=\"0x0100\"/> \ |
2488 | 70 | </sequence> \ | 70 | </sequence> \ |
2489 | 71 | <sequence> \ | 71 | <sequence> \ |
2490 | 72 | <uuid value=\"0x0003\"/> \ | 72 | <uuid value=\"0x0003\"/> \ |
2491 | 73 | <uint8 value=\"%u\" name=\"channel\"/> \ | 73 | <uint8 value=\"%u\" name=\"channel\"/> \ |
2492 | 74 | </sequence> \ | 74 | </sequence> \ |
2493 | 75 | <sequence> \ | 75 | <sequence> \ |
2494 | 76 | <uuid value=\"0x0008\"/> \ | 76 | <uuid value=\"0x0008\"/> \ |
2495 | 77 | </sequence> \ | 77 | </sequence> \ |
2496 | 78 | </sequence> \ | 78 | </sequence> \ |
2497 | 79 | </attribute> \ | 79 | </attribute> \ |
2498 | 80 | \ | 80 | \ |
2499 | 81 | <attribute id=\"0x0009\"> \ | 81 | <attribute id=\"0x0009\"> \ |
2500 | 82 | <sequence> \ | 82 | <sequence> \ |
2501 | 83 | <sequence> \ | 83 | <sequence> \ |
2502 | 84 | <uuid value=\"0x1106\"/> \ | 84 | <uuid value=\"0x1106\"/> \ |
2503 | 85 | <uint16 value=\"0x0100\" name=\"version\"/> \ | 85 | <uint16 value=\"0x0100\" name=\"version\"/> \ |
2504 | 86 | </sequence> \ | 86 | </sequence> \ |
2505 | 87 | </sequence> \ | 87 | </sequence> \ |
2506 | 88 | </attribute> \ | 88 | </attribute> \ |
2507 | 89 | \ | 89 | \ |
2508 | 90 | <attribute id=\"0x0100\"> \ | 90 | <attribute id=\"0x0100\"> \ |
2509 | 91 | <text value=\"%s\" name=\"name\"/> \ | 91 | <text value=\"%s\" name=\"name\"/> \ |
2510 | 92 | </attribute> \ | 92 | </attribute> \ |
2511 | 93 | </record>" | 93 | </record>" |
2512 | 94 | 94 | ||
2514 | 95 | #define PCSUITE_CHANNEL 24 | 95 | #define PCSUITE_CHANNEL 24 |
2515 | 96 | #define PCSUITE_WHO_SIZE 8 | 96 | #define PCSUITE_WHO_SIZE 8 |
2557 | 97 | #define PCSUITE_RECORD "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \ | 97 | |
2558 | 98 | <record> \ | 98 | #define PCSUITE_RECORD "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \ |
2559 | 99 | <attribute id=\"0x0001\"> \ | 99 | <record> \ |
2560 | 100 | <sequence> \ | 100 | <attribute id=\"0x0001\"> \ |
2561 | 101 | <uuid value=\"00005005-0000-1000-8000-0002ee000001\"/> \ | 101 | <sequence> \ |
2562 | 102 | </sequence> \ | 102 | <uuid value=\"00005005-0000-1000-8000-0002ee000001\"/> \ |
2563 | 103 | </attribute> \ | 103 | </sequence> \ |
2564 | 104 | \ | 104 | </attribute> \ |
2565 | 105 | <attribute id=\"0x0004\"> \ | 105 | \ |
2566 | 106 | <sequence> \ | 106 | <attribute id=\"0x0004\"> \ |
2567 | 107 | <sequence> \ | 107 | <sequence> \ |
2568 | 108 | <uuid value=\"0x0100\"/> \ | 108 | <sequence> \ |
2569 | 109 | </sequence> \ | 109 | <uuid value=\"0x0100\"/> \ |
2570 | 110 | <sequence> \ | 110 | </sequence> \ |
2571 | 111 | <uuid value=\"0x0003\"/> \ | 111 | <sequence> \ |
2572 | 112 | <uint8 value=\"%u\" name=\"channel\"/> \ | 112 | <uuid value=\"0x0003\"/> \ |
2573 | 113 | </sequence> \ | 113 | <uint8 value=\"%u\" name=\"channel\"/> \ |
2574 | 114 | <sequence> \ | 114 | </sequence> \ |
2575 | 115 | <uuid value=\"0x0008\"/> \ | 115 | <sequence> \ |
2576 | 116 | </sequence> \ | 116 | <uuid value=\"0x0008\"/> \ |
2577 | 117 | </sequence> \ | 117 | </sequence> \ |
2578 | 118 | </attribute> \ | 118 | </sequence> \ |
2579 | 119 | \ | 119 | </attribute> \ |
2580 | 120 | <attribute id=\"0x0005\"> \ | 120 | \ |
2581 | 121 | <sequence> \ | 121 | <attribute id=\"0x0005\"> \ |
2582 | 122 | <uuid value=\"0x1002\"/> \ | 122 | <sequence> \ |
2583 | 123 | </sequence> \ | 123 | <uuid value=\"0x1002\"/> \ |
2584 | 124 | </attribute> \ | 124 | </sequence> \ |
2585 | 125 | \ | 125 | </attribute> \ |
2586 | 126 | <attribute id=\"0x0009\"> \ | 126 | \ |
2587 | 127 | <sequence> \ | 127 | <attribute id=\"0x0009\"> \ |
2588 | 128 | <sequence> \ | 128 | <sequence> \ |
2589 | 129 | <uuid value=\"00005005-0000-1000-8000-0002ee000001\"/> \ | 129 | <sequence> \ |
2590 | 130 | <uint16 value=\"0x0100\" name=\"version\"/> \ | 130 | <uuid value=\"00005005-0000-1000-8000-0002ee000001\"/> \ |
2591 | 131 | </sequence> \ | 131 | <uint16 value=\"0x0100\" name=\"version\"/> \ |
2592 | 132 | </sequence> \ | 132 | </sequence> \ |
2593 | 133 | </attribute> \ | 133 | </sequence> \ |
2594 | 134 | \ | 134 | </attribute> \ |
2595 | 135 | <attribute id=\"0x0100\"> \ | 135 | \ |
2596 | 136 | <text value=\"%s\" name=\"name\"/> \ | 136 | <attribute id=\"0x0100\"> \ |
2597 | 137 | </attribute> \ | 137 | <text value=\"%s\" name=\"name\"/> \ |
2598 | 138 | </attribute> \ | ||
2599 | 138 | </record>" | 139 | </record>" |
2600 | 139 | 140 | ||
2604 | 140 | static const guint8 FTP_TARGET[TARGET_SIZE] = { | 141 | static const uint8_t FTP_TARGET[TARGET_SIZE] = { |
2605 | 141 | 0xF9, 0xEC, 0x7B, 0xC4, 0x95, 0x3C, 0x11, 0xD2, | 142 | 0xF9, 0xEC, 0x7B, 0xC4, 0x95, 0x3C, 0x11, 0xD2, |
2606 | 142 | 0x98, 0x4E, 0x52, 0x54, 0x00, 0xDC, 0x9E, 0x09 }; | 143 | 0x98, 0x4E, 0x52, 0x54, 0x00, 0xDC, 0x9E, 0x09 }; |
2607 | 143 | 144 | ||
2609 | 144 | static const guint8 PCSUITE_WHO[PCSUITE_WHO_SIZE] = { | 145 | static const uint8_t PCSUITE_WHO[PCSUITE_WHO_SIZE] = { |
2610 | 145 | 'P','C',' ','S','u','i','t','e' }; | 146 | 'P','C',' ','S','u','i','t','e' }; |
2611 | 146 | 147 | ||
2612 | 147 | struct ftp_session { | 148 | struct ftp_session { |
2613 | 148 | struct obex_session *os; | 149 | struct obex_session *os; |
2615 | 149 | gchar *folder; | 150 | char *folder; |
2616 | 150 | }; | 151 | }; |
2617 | 151 | 152 | ||
2618 | 152 | static void set_folder(struct ftp_session *ftp, const char *new_folder) | 153 | static void set_folder(struct ftp_session *ftp, const char *new_folder) |
2619 | @@ -156,49 +157,32 @@ | |||
2620 | 156 | ftp->folder = new_folder ? g_strdup(new_folder) : NULL; | 157 | ftp->folder = new_folder ? g_strdup(new_folder) : NULL; |
2621 | 157 | } | 158 | } |
2622 | 158 | 159 | ||
2624 | 159 | static gint get_by_type(struct ftp_session *ftp, const gchar *type) | 160 | static int get_by_type(struct ftp_session *ftp, const char *type) |
2625 | 160 | { | 161 | { |
2626 | 161 | struct obex_session *os = ftp->os; | 162 | struct obex_session *os = ftp->os; |
2627 | 162 | const char *capability = obex_get_capability_path(os); | 163 | const char *capability = obex_get_capability_path(os); |
2667 | 163 | 164 | const char *name = obex_get_name(os); | |
2668 | 164 | if (type == NULL) | 165 | char *path; |
2669 | 165 | return -ENOENT; | 166 | int err; |
2670 | 166 | 167 | ||
2671 | 167 | if (g_str_equal(type, CAP_TYPE)) | 168 | if (type == NULL && name == NULL) |
2672 | 168 | return obex_stream_start(os, capability, NULL); | 169 | return -EBADR; |
2673 | 169 | 170 | ||
2674 | 170 | if (g_str_equal(type, LST_TYPE)) | 171 | if (g_strcmp0(type, CAP_TYPE) == 0) |
2675 | 171 | return obex_stream_start(os, ftp->folder, os); | 172 | return obex_get_stream_start(os, capability); |
2676 | 172 | 173 | ||
2677 | 173 | return -ENOENT; | 174 | if (g_strcmp0(type, LST_TYPE) == 0) |
2678 | 174 | } | 175 | return obex_get_stream_start(os, ftp->folder); |
2679 | 175 | 176 | ||
2680 | 176 | static gint ftp_prepare_get(struct ftp_session *ftp, gchar *file) | 177 | path = g_build_filename(ftp->folder, name, NULL); |
2681 | 177 | { | 178 | err = obex_get_stream_start(os, path); |
2682 | 178 | struct obex_session *os = ftp->os; | 179 | |
2683 | 179 | const char *root_folder = obex_get_root_folder(os); | 180 | g_free(path); |
2684 | 180 | gboolean root; | 181 | |
2685 | 181 | 182 | return err; | |
2686 | 182 | root = g_str_equal(root_folder, ftp->folder); | 183 | } |
2687 | 183 | 184 | ||
2688 | 184 | if (!root || !obex_get_symlinks(os)) { | 185 | static void *ftp_connect(struct obex_session *os, int *err) |
2650 | 185 | struct stat dstat; | ||
2651 | 186 | gint err; | ||
2652 | 187 | |||
2653 | 188 | if (lstat(file, &dstat) < 0) { | ||
2654 | 189 | err = -errno; | ||
2655 | 190 | debug("lstat: %s(%d)", strerror(errno), errno); | ||
2656 | 191 | return err; | ||
2657 | 192 | } | ||
2658 | 193 | |||
2659 | 194 | if (S_ISLNK(dstat.st_mode)) | ||
2660 | 195 | return -EPERM; | ||
2661 | 196 | } | ||
2662 | 197 | |||
2663 | 198 | return obex_stream_start(os, file, NULL); | ||
2664 | 199 | } | ||
2665 | 200 | |||
2666 | 201 | static gpointer ftp_connect(struct obex_session *os, int *err) | ||
2689 | 202 | { | 186 | { |
2690 | 203 | struct ftp_session *ftp; | 187 | struct ftp_session *ftp; |
2691 | 204 | const char *root_folder; | 188 | const char *root_folder; |
2692 | @@ -218,43 +202,28 @@ | |||
2693 | 218 | } | 202 | } |
2694 | 219 | 203 | ||
2695 | 220 | static int ftp_get(struct obex_session *os, obex_object_t *obj, | 204 | static int ftp_get(struct obex_session *os, obex_object_t *obj, |
2697 | 221 | gpointer user_data) | 205 | gboolean *stream, void *user_data) |
2698 | 222 | { | 206 | { |
2699 | 223 | struct ftp_session *ftp = user_data; | 207 | struct ftp_session *ftp = user_data; |
2700 | 224 | const char *type = obex_get_type(os); | 208 | const char *type = obex_get_type(os); |
2724 | 225 | const char *name = obex_get_name(os); | 209 | int ret; |
2725 | 226 | gint err; | 210 | |
2726 | 227 | gchar *path; | 211 | if (ftp->folder == NULL) |
2727 | 228 | 212 | return -ENOENT; | |
2728 | 229 | if (ftp->folder == NULL) { | 213 | |
2729 | 230 | err = -ENOENT; | 214 | ret = get_by_type(ftp, type); |
2730 | 231 | goto fail; | 215 | if (ret < 0) |
2731 | 232 | } | 216 | return ret; |
2732 | 233 | 217 | ||
2733 | 234 | err = get_by_type(ftp, type); | 218 | if (stream) |
2734 | 235 | if (err < 0) { | 219 | *stream = TRUE; |
2712 | 236 | if (!name) | ||
2713 | 237 | goto fail; | ||
2714 | 238 | |||
2715 | 239 | path = g_build_filename(ftp->folder, name, NULL); | ||
2716 | 240 | |||
2717 | 241 | err = ftp_prepare_get(ftp, path); | ||
2718 | 242 | |||
2719 | 243 | g_free(path); | ||
2720 | 244 | |||
2721 | 245 | if (err < 0) | ||
2722 | 246 | goto fail; | ||
2723 | 247 | } | ||
2735 | 248 | 220 | ||
2736 | 249 | return 0; | 221 | return 0; |
2737 | 250 | |||
2738 | 251 | fail: | ||
2739 | 252 | return err; | ||
2740 | 253 | } | 222 | } |
2741 | 254 | 223 | ||
2743 | 255 | static gint ftp_delete(struct ftp_session *ftp, const char *name) | 224 | static int ftp_delete(struct ftp_session *ftp, const char *name) |
2744 | 256 | { | 225 | { |
2746 | 257 | gchar *path; | 226 | char *path; |
2747 | 258 | int ret = 0; | 227 | int ret = 0; |
2748 | 259 | 228 | ||
2749 | 260 | if (!(ftp->folder && name)) | 229 | if (!(ftp->folder && name)) |
2750 | @@ -270,26 +239,29 @@ | |||
2751 | 270 | return ret; | 239 | return ret; |
2752 | 271 | } | 240 | } |
2753 | 272 | 241 | ||
2755 | 273 | static gint ftp_chkput(struct obex_session *os, gpointer user_data) | 242 | static int ftp_chkput(struct obex_session *os, void *user_data) |
2756 | 274 | { | 243 | { |
2757 | 275 | struct ftp_session *ftp = user_data; | 244 | struct ftp_session *ftp = user_data; |
2760 | 276 | const gchar *name = obex_get_name(os); | 245 | const char *name = obex_get_name(os); |
2761 | 277 | gchar *path; | 246 | char *path; |
2762 | 278 | int ret; | 247 | int ret; |
2763 | 279 | 248 | ||
2764 | 249 | if (name == NULL) | ||
2765 | 250 | return -EBADR; | ||
2766 | 251 | |||
2767 | 280 | if (obex_get_size(os) == OBJECT_SIZE_DELETE) | 252 | if (obex_get_size(os) == OBJECT_SIZE_DELETE) |
2768 | 281 | return 0; | 253 | return 0; |
2769 | 282 | 254 | ||
2770 | 283 | path = g_build_filename(ftp->folder, name, NULL); | 255 | path = g_build_filename(ftp->folder, name, NULL); |
2771 | 284 | 256 | ||
2773 | 285 | ret = obex_prepare_put(os, path); | 257 | ret = obex_put_stream_start(os, path); |
2774 | 286 | 258 | ||
2775 | 287 | g_free(path); | 259 | g_free(path); |
2776 | 288 | 260 | ||
2777 | 289 | return ret; | 261 | return ret; |
2778 | 290 | } | 262 | } |
2779 | 291 | 263 | ||
2781 | 292 | static int ftp_put(struct obex_session *os, gpointer user_data) | 264 | static int ftp_put(struct obex_session *os, void *user_data) |
2782 | 293 | { | 265 | { |
2783 | 294 | struct ftp_session *ftp = user_data; | 266 | struct ftp_session *ftp = user_data; |
2784 | 295 | const char *name = obex_get_name(os); | 267 | const char *name = obex_get_name(os); |
2785 | @@ -308,12 +280,12 @@ | |||
2786 | 308 | } | 280 | } |
2787 | 309 | 281 | ||
2788 | 310 | static int ftp_setpath(struct obex_session *os, obex_object_t *obj, | 282 | static int ftp_setpath(struct obex_session *os, obex_object_t *obj, |
2790 | 311 | gpointer user_data) | 283 | void *user_data) |
2791 | 312 | { | 284 | { |
2792 | 313 | struct ftp_session *ftp = user_data; | 285 | struct ftp_session *ftp = user_data; |
2796 | 314 | const gchar *root_folder, *name; | 286 | const char *root_folder, *name; |
2797 | 315 | guint8 *nonhdr; | 287 | uint8_t *nonhdr; |
2798 | 316 | gchar *fullname; | 288 | char *fullname; |
2799 | 317 | struct stat dstat; | 289 | struct stat dstat; |
2800 | 318 | gboolean root; | 290 | gboolean root; |
2801 | 319 | int err; | 291 | int err; |
2802 | @@ -370,11 +342,13 @@ | |||
2803 | 370 | err = lstat(fullname, &dstat); | 342 | err = lstat(fullname, &dstat); |
2804 | 371 | 343 | ||
2805 | 372 | if (err < 0) { | 344 | if (err < 0) { |
2807 | 373 | int err = errno; | 345 | err = -errno; |
2808 | 346 | |||
2809 | 347 | if (err == -ENOENT) | ||
2810 | 348 | goto not_found; | ||
2811 | 349 | |||
2812 | 374 | debug("%s: %s(%d)", root ? "stat" : "lstat", | 350 | debug("%s: %s(%d)", root ? "stat" : "lstat", |
2816 | 375 | strerror(err), err); | 351 | strerror(-err), -err); |
2814 | 376 | if (err == ENOENT) | ||
2815 | 377 | goto not_found; | ||
2817 | 378 | 352 | ||
2818 | 379 | goto done; | 353 | goto done; |
2819 | 380 | } | 354 | } |
2820 | @@ -395,10 +369,12 @@ | |||
2821 | 395 | } | 369 | } |
2822 | 396 | 370 | ||
2823 | 397 | if (mkdir(fullname, 0755) < 0) { | 371 | if (mkdir(fullname, 0755) < 0) { |
2825 | 398 | err = -EPERM; | 372 | err = -errno; |
2826 | 373 | debug("mkdir: %s(%d)", strerror(-err), -err); | ||
2827 | 399 | goto done; | 374 | goto done; |
2828 | 400 | } | 375 | } |
2829 | 401 | 376 | ||
2830 | 377 | err = 0; | ||
2831 | 402 | set_folder(ftp, fullname); | 378 | set_folder(ftp, fullname); |
2832 | 403 | 379 | ||
2833 | 404 | done: | 380 | done: |
2834 | @@ -406,7 +382,7 @@ | |||
2835 | 406 | return err; | 382 | return err; |
2836 | 407 | } | 383 | } |
2837 | 408 | 384 | ||
2839 | 409 | static void ftp_disconnect(struct obex_session *os, gpointer user_data) | 385 | static void ftp_disconnect(struct obex_session *os, void *user_data) |
2840 | 410 | { | 386 | { |
2841 | 411 | struct ftp_session *ftp = user_data; | 387 | struct ftp_session *ftp = user_data; |
2842 | 412 | 388 | ||
2843 | @@ -416,7 +392,7 @@ | |||
2844 | 416 | g_free(ftp); | 392 | g_free(ftp); |
2845 | 417 | } | 393 | } |
2846 | 418 | 394 | ||
2848 | 419 | struct obex_service_driver pcsuite = { | 395 | static struct obex_service_driver pcsuite = { |
2849 | 420 | .name = "Nokia OBEX PC Suite Services", | 396 | .name = "Nokia OBEX PC Suite Services", |
2850 | 421 | .service = OBEX_PCSUITE, | 397 | .service = OBEX_PCSUITE, |
2851 | 422 | .channel = PCSUITE_CHANNEL, | 398 | .channel = PCSUITE_CHANNEL, |
2852 | @@ -433,7 +409,7 @@ | |||
2853 | 433 | .disconnect = ftp_disconnect | 409 | .disconnect = ftp_disconnect |
2854 | 434 | }; | 410 | }; |
2855 | 435 | 411 | ||
2857 | 436 | struct obex_service_driver ftp = { | 412 | static struct obex_service_driver ftp = { |
2858 | 437 | .name = "File Transfer server", | 413 | .name = "File Transfer server", |
2859 | 438 | .service = OBEX_FTP, | 414 | .service = OBEX_FTP, |
2860 | 439 | .channel = FTP_CHANNEL, | 415 | .channel = FTP_CHANNEL, |
2861 | 440 | 416 | ||
2862 | === added file 'plugins/nokia-backup.c' | |||
2863 | --- plugins/nokia-backup.c 1970-01-01 00:00:00 +0000 | |||
2864 | +++ plugins/nokia-backup.c 2010-06-15 19:18:33 +0000 | |||
2865 | @@ -0,0 +1,295 @@ | |||
2866 | 1 | /* | ||
2867 | 2 | * | ||
2868 | 3 | * OBEX Server | ||
2869 | 4 | * | ||
2870 | 5 | * Copyright (C) 2010 Nokia Corporation | ||
2871 | 6 | * Copyright (C) 2010 Marcel Holtmann <marcel@holtmann.org> | ||
2872 | 7 | * | ||
2873 | 8 | * | ||
2874 | 9 | * This program is free software; you can redistribute it and/or modify | ||
2875 | 10 | * it under the terms of the GNU General Public License as published by | ||
2876 | 11 | * the Free Software Foundation; either version 2 of the License, or | ||
2877 | 12 | * (at your option) any later version. | ||
2878 | 13 | * | ||
2879 | 14 | * This program is distributed in the hope that it will be useful, | ||
2880 | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2881 | 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2882 | 17 | * GNU General Public License for more details. | ||
2883 | 18 | * | ||
2884 | 19 | * You should have received a copy of the GNU General Public License | ||
2885 | 20 | * along with this program; if not, write to the Free Software | ||
2886 | 21 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
2887 | 22 | * | ||
2888 | 23 | */ | ||
2889 | 24 | |||
2890 | 25 | #ifdef HAVE_CONFIG_H | ||
2891 | 26 | #include <config.h> | ||
2892 | 27 | #endif | ||
2893 | 28 | |||
2894 | 29 | #include <stdio.h> | ||
2895 | 30 | #include <errno.h> | ||
2896 | 31 | #include <stdlib.h> | ||
2897 | 32 | #include <string.h> | ||
2898 | 33 | #include <unistd.h> | ||
2899 | 34 | #include <dirent.h> | ||
2900 | 35 | #include <sys/stat.h> | ||
2901 | 36 | #include <sys/types.h> | ||
2902 | 37 | #include <sys/stat.h> | ||
2903 | 38 | #include <sys/statvfs.h> | ||
2904 | 39 | #include <fcntl.h> | ||
2905 | 40 | #include <wait.h> | ||
2906 | 41 | |||
2907 | 42 | #include <glib.h> | ||
2908 | 43 | #include "gdbus.h" | ||
2909 | 44 | |||
2910 | 45 | |||
2911 | 46 | #include <openobex/obex.h> | ||
2912 | 47 | #include <openobex/obex_const.h> | ||
2913 | 48 | |||
2914 | 49 | #include "plugin.h" | ||
2915 | 50 | #include "logging.h" | ||
2916 | 51 | #include "obex.h" | ||
2917 | 52 | #include "mimetype.h" | ||
2918 | 53 | #include "service.h" | ||
2919 | 54 | |||
2920 | 55 | #define BACKUP_BUS_NAME "com.nokia.backup.plugin" | ||
2921 | 56 | #define BACKUP_PATH "/com/nokia/backup" | ||
2922 | 57 | #define BACKUP_PLUGIN_INTERFACE "com.nokia.backup.plugin" | ||
2923 | 58 | #define BACKUP_DBUS_TIMEOUT (1000 * 60 * 15) | ||
2924 | 59 | |||
2925 | 60 | static const uint8_t FTP_TARGET[TARGET_SIZE] = { | ||
2926 | 61 | 0xF9, 0xEC, 0x7B, 0xC4, 0x95, 0x3C, 0x11, 0xD2, | ||
2927 | 62 | 0x98, 0x4E, 0x52, 0x54, 0x00, 0xDC, 0x9E, 0x09 }; | ||
2928 | 63 | |||
2929 | 64 | struct backup_object{ | ||
2930 | 65 | gchar *cmd; | ||
2931 | 66 | int fd; | ||
2932 | 67 | int oflag; | ||
2933 | 68 | int error_code; | ||
2934 | 69 | mode_t mode; | ||
2935 | 70 | DBusPendingCall *pending_call; | ||
2936 | 71 | DBusConnection *conn; | ||
2937 | 72 | }; | ||
2938 | 73 | |||
2939 | 74 | static void on_backup_dbus_notify(DBusPendingCall *pending_call, | ||
2940 | 75 | void *user_data) | ||
2941 | 76 | { | ||
2942 | 77 | struct backup_object *obj = user_data; | ||
2943 | 78 | DBusMessage *reply; | ||
2944 | 79 | const char *filename; | ||
2945 | 80 | int error_code; | ||
2946 | 81 | |||
2947 | 82 | debug("backup: Notification received for pending call - %s", obj->cmd); | ||
2948 | 83 | |||
2949 | 84 | reply = dbus_pending_call_steal_reply(pending_call); | ||
2950 | 85 | |||
2951 | 86 | if (reply && dbus_message_get_args(reply, NULL, DBUS_TYPE_INT32, | ||
2952 | 87 | &error_code, DBUS_TYPE_STRING, | ||
2953 | 88 | &filename, DBUS_TYPE_INVALID)) { | ||
2954 | 89 | |||
2955 | 90 | obj->error_code = error_code; | ||
2956 | 91 | |||
2957 | 92 | if (filename) { | ||
2958 | 93 | debug("backup: Notification - file path = %s," | ||
2959 | 94 | "error_code = %d", filename, | ||
2960 | 95 | error_code); | ||
2961 | 96 | if (error_code == 0) | ||
2962 | 97 | obj->fd = open(filename,obj->oflag,obj->mode); | ||
2963 | 98 | } | ||
2964 | 99 | |||
2965 | 100 | } else | ||
2966 | 101 | debug("backup: Notification timed out or connection got closed"); | ||
2967 | 102 | |||
2968 | 103 | if (reply) | ||
2969 | 104 | dbus_message_unref(reply); | ||
2970 | 105 | |||
2971 | 106 | dbus_pending_call_unref(pending_call); | ||
2972 | 107 | obj->pending_call = NULL; | ||
2973 | 108 | dbus_connection_unref(obj->conn); | ||
2974 | 109 | obj->conn = NULL; | ||
2975 | 110 | |||
2976 | 111 | if (obj->fd >= 0) { | ||
2977 | 112 | debug("backup: File opened, setting io flags, cmd = %s", | ||
2978 | 113 | obj->cmd); | ||
2979 | 114 | if (obj->oflag == O_RDONLY) | ||
2980 | 115 | obex_object_set_io_flags(user_data, G_IO_IN, 0); | ||
2981 | 116 | else | ||
2982 | 117 | obex_object_set_io_flags(user_data, G_IO_OUT, 0); | ||
2983 | 118 | } else { | ||
2984 | 119 | debug("backup: File open error, setting io error, cmd = %s", | ||
2985 | 120 | obj->cmd); | ||
2986 | 121 | obex_object_set_io_flags(user_data, G_IO_ERR, -EPERM); | ||
2987 | 122 | } | ||
2988 | 123 | } | ||
2989 | 124 | |||
2990 | 125 | static gboolean send_backup_dbus_message(const char *oper, | ||
2991 | 126 | struct backup_object *obj, | ||
2992 | 127 | size_t *size) | ||
2993 | 128 | { | ||
2994 | 129 | DBusConnection *conn; | ||
2995 | 130 | DBusMessage *msg; | ||
2996 | 131 | DBusPendingCall *pending_call; | ||
2997 | 132 | gboolean ret = FALSE; | ||
2998 | 133 | dbus_uint32_t file_size; | ||
2999 | 134 | |||
3000 | 135 | file_size = size ? *size : 0; | ||
3001 | 136 | |||
3002 | 137 | conn = g_dbus_setup_bus(DBUS_BUS_SESSION, NULL, NULL); | ||
3003 | 138 | |||
3004 | 139 | if (conn == NULL) | ||
3005 | 140 | return FALSE; | ||
3006 | 141 | |||
3007 | 142 | msg = dbus_message_new_method_call(BACKUP_BUS_NAME, BACKUP_PATH, | ||
3008 | 143 | BACKUP_PLUGIN_INTERFACE, | ||
3009 | 144 | "request"); | ||
3010 | 145 | if (msg == NULL) { | ||
3011 | 146 | dbus_connection_unref(conn); | ||
3012 | 147 | return FALSE; | ||
3013 | 148 | } | ||
3014 | 149 | |||
3015 | 150 | dbus_message_append_args(msg, DBUS_TYPE_STRING, &oper, | ||
3016 | 151 | DBUS_TYPE_STRING, &obj->cmd, | ||
3017 | 152 | DBUS_TYPE_INT32, &file_size, | ||
3018 | 153 | DBUS_TYPE_INVALID); | ||
3019 | 154 | |||
3020 | 155 | ret = dbus_connection_send_with_reply(conn, msg, &pending_call, | ||
3021 | 156 | BACKUP_DBUS_TIMEOUT); | ||
3022 | 157 | |||
3023 | 158 | dbus_message_unref(msg); | ||
3024 | 159 | |||
3025 | 160 | if (ret && (strcmp(oper, "open") == 0)) { | ||
3026 | 161 | obj->conn = conn; | ||
3027 | 162 | obj->pending_call = pending_call; | ||
3028 | 163 | ret = dbus_pending_call_set_notify(pending_call, | ||
3029 | 164 | on_backup_dbus_notify, | ||
3030 | 165 | obj, NULL); | ||
3031 | 166 | } else { | ||
3032 | 167 | dbus_pending_call_unref(pending_call); | ||
3033 | 168 | dbus_connection_unref(conn); | ||
3034 | 169 | } | ||
3035 | 170 | |||
3036 | 171 | return ret; | ||
3037 | 172 | } | ||
3038 | 173 | |||
3039 | 174 | static void *backup_open(const char *name, int oflag, mode_t mode, | ||
3040 | 175 | void *context, size_t *size, int *err) | ||
3041 | 176 | { | ||
3042 | 177 | struct backup_object *obj = g_new0(struct backup_object, 1); | ||
3043 | 178 | |||
3044 | 179 | debug("backup: open(), cmd = %s", name); | ||
3045 | 180 | |||
3046 | 181 | obj->cmd = g_path_get_basename(name); | ||
3047 | 182 | obj->oflag = oflag; | ||
3048 | 183 | obj->mode = mode; | ||
3049 | 184 | obj->fd = -1; | ||
3050 | 185 | obj->pending_call = NULL; | ||
3051 | 186 | obj->conn = NULL; | ||
3052 | 187 | obj->error_code = 0; | ||
3053 | 188 | |||
3054 | 189 | if (send_backup_dbus_message("open", obj, size) == FALSE) { | ||
3055 | 190 | g_free(obj); | ||
3056 | 191 | obj = NULL; | ||
3057 | 192 | } | ||
3058 | 193 | |||
3059 | 194 | if (err) | ||
3060 | 195 | *err = 0; | ||
3061 | 196 | |||
3062 | 197 | return obj; | ||
3063 | 198 | } | ||
3064 | 199 | |||
3065 | 200 | static int backup_close(void *object) | ||
3066 | 201 | { | ||
3067 | 202 | struct backup_object *obj = object; | ||
3068 | 203 | size_t size = 0; | ||
3069 | 204 | |||
3070 | 205 | debug("backup: close(), cmd = %s", obj->cmd); | ||
3071 | 206 | |||
3072 | 207 | if (obj->fd != -1) | ||
3073 | 208 | close(obj->fd); | ||
3074 | 209 | |||
3075 | 210 | if (obj->pending_call) { | ||
3076 | 211 | dbus_pending_call_cancel(obj->pending_call); | ||
3077 | 212 | dbus_pending_call_unref(obj->pending_call); | ||
3078 | 213 | dbus_connection_unref(obj->conn); | ||
3079 | 214 | } | ||
3080 | 215 | |||
3081 | 216 | send_backup_dbus_message("close", obj, &size); | ||
3082 | 217 | |||
3083 | 218 | g_free(obj->cmd); | ||
3084 | 219 | g_free(obj); | ||
3085 | 220 | |||
3086 | 221 | return 0; | ||
3087 | 222 | } | ||
3088 | 223 | |||
3089 | 224 | static ssize_t backup_read(void *object, void *buf, size_t count, uint8_t *hi) | ||
3090 | 225 | { | ||
3091 | 226 | struct backup_object *obj = object; | ||
3092 | 227 | ssize_t ret = 0; | ||
3093 | 228 | |||
3094 | 229 | *hi = OBEX_HDR_BODY; | ||
3095 | 230 | |||
3096 | 231 | if (obj->pending_call) { | ||
3097 | 232 | debug("backup: read(), cmd = %s, IN WAITING STAGE", obj->cmd); | ||
3098 | 233 | return -EAGAIN; | ||
3099 | 234 | } | ||
3100 | 235 | |||
3101 | 236 | if (obj->fd != -1) { | ||
3102 | 237 | debug("backup: read(), cmd = %s, READING DATA", obj->cmd); | ||
3103 | 238 | ret = read(obj->fd, buf, count); | ||
3104 | 239 | if (ret < 0) | ||
3105 | 240 | ret = -errno; | ||
3106 | 241 | } else { | ||
3107 | 242 | debug("backup: read(), cmd = %s, PERMANENT FAILURE", obj->cmd); | ||
3108 | 243 | ret = obj->error_code?(-obj->error_code):(-ENOENT); | ||
3109 | 244 | } | ||
3110 | 245 | |||
3111 | 246 | return ret; | ||
3112 | 247 | } | ||
3113 | 248 | |||
3114 | 249 | static ssize_t backup_write(void *object, const void *buf, size_t count) | ||
3115 | 250 | { | ||
3116 | 251 | struct backup_object *obj = object; | ||
3117 | 252 | ssize_t ret = 0; | ||
3118 | 253 | |||
3119 | 254 | if (obj->pending_call) { | ||
3120 | 255 | debug("backup: write(), cmd = %s, IN WAITING STAGE", obj->cmd); | ||
3121 | 256 | return -EAGAIN; | ||
3122 | 257 | } | ||
3123 | 258 | |||
3124 | 259 | if (obj->fd != -1) { | ||
3125 | 260 | ret = write(obj->fd, buf, count); | ||
3126 | 261 | |||
3127 | 262 | debug("backup: write(), cmd = %s, WRITTING", obj->cmd); | ||
3128 | 263 | |||
3129 | 264 | if (ret < 0) { | ||
3130 | 265 | debug("backup: write() error, cmd = %s", obj->cmd); | ||
3131 | 266 | ret = -errno; | ||
3132 | 267 | } | ||
3133 | 268 | } else { | ||
3134 | 269 | debug("backup: write() error, cmd = %s", obj->cmd); | ||
3135 | 270 | ret = obj->error_code ? -obj->error_code : -ENOENT; | ||
3136 | 271 | } | ||
3137 | 272 | |||
3138 | 273 | return ret; | ||
3139 | 274 | } | ||
3140 | 275 | |||
3141 | 276 | static struct obex_mime_type_driver backup = { | ||
3142 | 277 | .target = FTP_TARGET, | ||
3143 | 278 | .mimetype = "application/vnd.nokia-backup", | ||
3144 | 279 | .open = backup_open, | ||
3145 | 280 | .close = backup_close, | ||
3146 | 281 | .read = backup_read, | ||
3147 | 282 | .write = backup_write, | ||
3148 | 283 | }; | ||
3149 | 284 | |||
3150 | 285 | static int backup_init(void) | ||
3151 | 286 | { | ||
3152 | 287 | return obex_mime_type_driver_register(&backup); | ||
3153 | 288 | } | ||
3154 | 289 | |||
3155 | 290 | static void backup_exit(void) | ||
3156 | 291 | { | ||
3157 | 292 | obex_mime_type_driver_unregister(&backup); | ||
3158 | 293 | } | ||
3159 | 294 | |||
3160 | 295 | OBEX_PLUGIN_DEFINE(backup, backup_init, backup_exit) | ||
3161 | 0 | 296 | ||
3162 | === modified file 'plugins/opp.c' | |||
3163 | --- plugins/opp.c 2010-04-27 04:17:15 +0000 | |||
3164 | +++ plugins/opp.c 2010-06-15 19:18:33 +0000 | |||
3165 | @@ -27,6 +27,7 @@ | |||
3166 | 27 | #endif | 27 | #endif |
3167 | 28 | 28 | ||
3168 | 29 | #include <errno.h> | 29 | #include <errno.h> |
3169 | 30 | #include <string.h> | ||
3170 | 30 | 31 | ||
3171 | 31 | #include <openobex/obex.h> | 32 | #include <openobex/obex.h> |
3172 | 32 | #include <openobex/obex_const.h> | 33 | #include <openobex/obex_const.h> |
3173 | @@ -44,56 +45,56 @@ | |||
3174 | 44 | 45 | ||
3175 | 45 | #define OPP_CHANNEL 9 | 46 | #define OPP_CHANNEL 9 |
3176 | 46 | #define OPP_RECORD "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \ | 47 | #define OPP_RECORD "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \ |
3224 | 47 | <record> \ | 48 | <record> \ |
3225 | 48 | <attribute id=\"0x0001\"> \ | 49 | <attribute id=\"0x0001\"> \ |
3226 | 49 | <sequence> \ | 50 | <sequence> \ |
3227 | 50 | <uuid value=\"0x1105\"/> \ | 51 | <uuid value=\"0x1105\"/> \ |
3228 | 51 | </sequence> \ | 52 | </sequence> \ |
3229 | 52 | </attribute> \ | 53 | </attribute> \ |
3230 | 53 | \ | 54 | \ |
3231 | 54 | <attribute id=\"0x0004\"> \ | 55 | <attribute id=\"0x0004\"> \ |
3232 | 55 | <sequence> \ | 56 | <sequence> \ |
3233 | 56 | <sequence> \ | 57 | <sequence> \ |
3234 | 57 | <uuid value=\"0x0100\"/> \ | 58 | <uuid value=\"0x0100\"/> \ |
3235 | 58 | </sequence> \ | 59 | </sequence> \ |
3236 | 59 | <sequence> \ | 60 | <sequence> \ |
3237 | 60 | <uuid value=\"0x0003\"/> \ | 61 | <uuid value=\"0x0003\"/> \ |
3238 | 61 | <uint8 value=\"%u\" name=\"channel\"/> \ | 62 | <uint8 value=\"%u\" name=\"channel\"/> \ |
3239 | 62 | </sequence> \ | 63 | </sequence> \ |
3240 | 63 | <sequence> \ | 64 | <sequence> \ |
3241 | 64 | <uuid value=\"0x0008\"/> \ | 65 | <uuid value=\"0x0008\"/> \ |
3242 | 65 | </sequence> \ | 66 | </sequence> \ |
3243 | 66 | </sequence> \ | 67 | </sequence> \ |
3244 | 67 | </attribute> \ | 68 | </attribute> \ |
3245 | 68 | \ | 69 | \ |
3246 | 69 | <attribute id=\"0x0009\"> \ | 70 | <attribute id=\"0x0009\"> \ |
3247 | 70 | <sequence> \ | 71 | <sequence> \ |
3248 | 71 | <sequence> \ | 72 | <sequence> \ |
3249 | 72 | <uuid value=\"0x1105\"/> \ | 73 | <uuid value=\"0x1105\"/> \ |
3250 | 73 | <uint16 value=\"0x0100\" name=\"version\"/> \ | 74 | <uint16 value=\"0x0100\" name=\"version\"/> \ |
3251 | 74 | </sequence> \ | 75 | </sequence> \ |
3252 | 75 | </sequence> \ | 76 | </sequence> \ |
3253 | 76 | </attribute> \ | 77 | </attribute> \ |
3254 | 77 | \ | 78 | \ |
3255 | 78 | <attribute id=\"0x0100\"> \ | 79 | <attribute id=\"0x0100\"> \ |
3256 | 79 | <text value=\"%s\" name=\"name\"/> \ | 80 | <text value=\"%s\" name=\"name\"/> \ |
3257 | 80 | </attribute> \ | 81 | </attribute> \ |
3258 | 81 | \ | 82 | \ |
3259 | 82 | <attribute id=\"0x0303\"> \ | 83 | <attribute id=\"0x0303\"> \ |
3260 | 83 | <sequence> \ | 84 | <sequence> \ |
3261 | 84 | <uint8 value=\"0x01\"/> \ | 85 | <uint8 value=\"0x01\"/> \ |
3262 | 85 | <uint8 value=\"0x01\"/> \ | 86 | <uint8 value=\"0x01\"/> \ |
3263 | 86 | <uint8 value=\"0x02\"/> \ | 87 | <uint8 value=\"0x02\"/> \ |
3264 | 87 | <uint8 value=\"0x03\"/> \ | 88 | <uint8 value=\"0x03\"/> \ |
3265 | 88 | <uint8 value=\"0x04\"/> \ | 89 | <uint8 value=\"0x04\"/> \ |
3266 | 89 | <uint8 value=\"0x05\"/> \ | 90 | <uint8 value=\"0x05\"/> \ |
3267 | 90 | <uint8 value=\"0x06\"/> \ | 91 | <uint8 value=\"0x06\"/> \ |
3268 | 91 | <uint8 value=\"0xff\"/> \ | 92 | <uint8 value=\"0xff\"/> \ |
3269 | 92 | </sequence> \ | 93 | </sequence> \ |
3270 | 93 | </attribute> \ | 94 | </attribute> \ |
3271 | 94 | </record>" | 95 | </record>" |
3272 | 95 | 96 | ||
3274 | 96 | static gpointer opp_connect(struct obex_session *os, int *err) | 97 | static void *opp_connect(struct obex_session *os, int *err) |
3275 | 97 | { | 98 | { |
3276 | 98 | manager_register_transfer(os); | 99 | manager_register_transfer(os); |
3277 | 99 | 100 | ||
3278 | @@ -103,17 +104,17 @@ | |||
3279 | 103 | return NULL; | 104 | return NULL; |
3280 | 104 | } | 105 | } |
3281 | 105 | 106 | ||
3283 | 106 | static void opp_progress(struct obex_session *os, gpointer user_data) | 107 | static void opp_progress(struct obex_session *os, void *user_data) |
3284 | 107 | { | 108 | { |
3285 | 108 | manager_emit_transfer_progress(os); | 109 | manager_emit_transfer_progress(os); |
3286 | 109 | } | 110 | } |
3287 | 110 | 111 | ||
3289 | 111 | static gint opp_chkput(struct obex_session *os, gpointer user_data) | 112 | static int opp_chkput(struct obex_session *os, void *user_data) |
3290 | 112 | { | 113 | { |
3295 | 113 | gchar *folder, *name; | 114 | char *folder, *name; |
3296 | 114 | gchar *path; | 115 | char *path; |
3297 | 115 | gint32 time; | 116 | int32_t time; |
3298 | 116 | gint ret; | 117 | int ret; |
3299 | 117 | 118 | ||
3300 | 118 | if (obex_get_size(os) == OBJECT_SIZE_DELETE) | 119 | if (obex_get_size(os) == OBJECT_SIZE_DELETE) |
3301 | 119 | return -EINVAL; | 120 | return -EINVAL; |
3302 | @@ -136,11 +137,17 @@ | |||
3303 | 136 | name = g_strdup(obex_get_name(os)); | 137 | name = g_strdup(obex_get_name(os)); |
3304 | 137 | 138 | ||
3305 | 138 | skip_auth: | 139 | skip_auth: |
3306 | 140 | if (name == NULL || strlen(name) == 0) | ||
3307 | 141 | return -EBADR; | ||
3308 | 142 | |||
3309 | 143 | if (g_strcmp0(name, obex_get_name(os)) != 0) | ||
3310 | 144 | obex_set_name(os, name); | ||
3311 | 145 | |||
3312 | 139 | path = g_build_filename(folder, name, NULL); | 146 | path = g_build_filename(folder, name, NULL); |
3313 | 140 | 147 | ||
3314 | 141 | manager_emit_transfer_started(os); | 148 | manager_emit_transfer_started(os); |
3315 | 142 | 149 | ||
3317 | 143 | ret = obex_prepare_put(os, path); | 150 | ret = obex_put_stream_start(os, path); |
3318 | 144 | 151 | ||
3319 | 145 | g_free(path); | 152 | g_free(path); |
3320 | 146 | g_free(folder); | 153 | g_free(folder); |
3321 | @@ -149,7 +156,7 @@ | |||
3322 | 149 | return ret; | 156 | return ret; |
3323 | 150 | } | 157 | } |
3324 | 151 | 158 | ||
3326 | 152 | static int opp_put(struct obex_session *os, gpointer user_data) | 159 | static int opp_put(struct obex_session *os, void *user_data) |
3327 | 153 | { | 160 | { |
3328 | 154 | const char *name = obex_get_name(os); | 161 | const char *name = obex_get_name(os); |
3329 | 155 | const char *folder = obex_get_root_folder(os); | 162 | const char *folder = obex_get_root_folder(os); |
3330 | @@ -164,7 +171,7 @@ | |||
3331 | 164 | } | 171 | } |
3332 | 165 | 172 | ||
3333 | 166 | static int opp_get(struct obex_session *os, obex_object_t *obj, | 173 | static int opp_get(struct obex_session *os, obex_object_t *obj, |
3335 | 167 | gpointer user_data) | 174 | gboolean *stream, void *user_data) |
3336 | 168 | { | 175 | { |
3337 | 169 | const char *type; | 176 | const char *type; |
3338 | 170 | 177 | ||
3339 | @@ -177,26 +184,29 @@ | |||
3340 | 177 | return -EPERM; | 184 | return -EPERM; |
3341 | 178 | 185 | ||
3342 | 179 | if (g_str_equal(type, VCARD_TYPE)) { | 186 | if (g_str_equal(type, VCARD_TYPE)) { |
3344 | 180 | if (obex_stream_start(os, VCARD_FILE, NULL) < 0) | 187 | if (obex_get_stream_start(os, VCARD_FILE) < 0) |
3345 | 181 | return -ENOENT; | 188 | return -ENOENT; |
3346 | 182 | 189 | ||
3347 | 183 | } else | 190 | } else |
3348 | 184 | return -EPERM; | 191 | return -EPERM; |
3349 | 185 | 192 | ||
3350 | 193 | if (stream) | ||
3351 | 194 | *stream = TRUE; | ||
3352 | 195 | |||
3353 | 186 | return 0; | 196 | return 0; |
3354 | 187 | } | 197 | } |
3355 | 188 | 198 | ||
3357 | 189 | static void opp_disconnect(struct obex_session *os, gpointer user_data) | 199 | static void opp_disconnect(struct obex_session *os, void *user_data) |
3358 | 190 | { | 200 | { |
3359 | 191 | manager_unregister_transfer(os); | 201 | manager_unregister_transfer(os); |
3360 | 192 | } | 202 | } |
3361 | 193 | 203 | ||
3363 | 194 | static void opp_reset(struct obex_session *os, gpointer user_data) | 204 | static void opp_reset(struct obex_session *os, void *user_data) |
3364 | 195 | { | 205 | { |
3365 | 196 | manager_emit_transfer_completed(os); | 206 | manager_emit_transfer_completed(os); |
3366 | 197 | } | 207 | } |
3367 | 198 | 208 | ||
3369 | 199 | struct obex_service_driver driver = { | 209 | static struct obex_service_driver driver = { |
3370 | 200 | .name = "Object Push server", | 210 | .name = "Object Push server", |
3371 | 201 | .service = OBEX_OPP, | 211 | .service = OBEX_OPP, |
3372 | 202 | .channel = OPP_CHANNEL, | 212 | .channel = OPP_CHANNEL, |
3373 | 203 | 213 | ||
3374 | === modified file 'plugins/pbap.c' | |||
3375 | --- plugins/pbap.c 2010-04-27 04:17:15 +0000 | |||
3376 | +++ plugins/pbap.c 2010-06-15 19:18:33 +0000 | |||
3377 | @@ -26,11 +26,13 @@ | |||
3378 | 26 | #include <config.h> | 26 | #include <config.h> |
3379 | 27 | #endif | 27 | #endif |
3380 | 28 | 28 | ||
3381 | 29 | #include <stdio.h> | ||
3382 | 29 | #include <string.h> | 30 | #include <string.h> |
3383 | 30 | #include <errno.h> | 31 | #include <errno.h> |
3384 | 31 | #include <glib.h> | 32 | #include <glib.h> |
3385 | 32 | #include <stdlib.h> | 33 | #include <stdlib.h> |
3386 | 33 | #include <unistd.h> | 34 | #include <unistd.h> |
3387 | 35 | #include <arpa/inet.h> | ||
3388 | 34 | #include <sys/types.h> | 36 | #include <sys/types.h> |
3389 | 35 | #include <sys/stat.h> | 37 | #include <sys/stat.h> |
3390 | 36 | #include <fcntl.h> | 38 | #include <fcntl.h> |
3391 | @@ -71,87 +73,382 @@ | |||
3392 | 71 | #define PHONEBOOKSIZE_LEN 2 | 73 | #define PHONEBOOKSIZE_LEN 2 |
3393 | 72 | #define NEWMISSEDCALLS_LEN 1 | 74 | #define NEWMISSEDCALLS_LEN 1 |
3394 | 73 | 75 | ||
3395 | 74 | #define MCH "telecom/mch.vcf" | ||
3396 | 75 | #define SIM1_MCH "SIM1/telecom/mch.vcf" | ||
3397 | 76 | |||
3398 | 77 | #define DEFAULT_COUNT 65535 | ||
3399 | 78 | |||
3400 | 79 | #define APPARAM_HDR_SIZE 2 | ||
3401 | 80 | |||
3402 | 81 | #define PBAP_CHANNEL 15 | 76 | #define PBAP_CHANNEL 15 |
3403 | 82 | 77 | ||
3404 | 83 | #define PBAP_RECORD "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \ | 78 | #define PBAP_RECORD "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \ |
3443 | 84 | <record> \ | 79 | <record> \ |
3444 | 85 | <attribute id=\"0x0001\"> \ | 80 | <attribute id=\"0x0001\"> \ |
3445 | 86 | <sequence> \ | 81 | <sequence> \ |
3446 | 87 | <uuid value=\"0x112f\"/> \ | 82 | <uuid value=\"0x112f\"/> \ |
3447 | 88 | </sequence> \ | 83 | </sequence> \ |
3448 | 89 | </attribute> \ | 84 | </attribute> \ |
3449 | 90 | \ | 85 | \ |
3450 | 91 | <attribute id=\"0x0004\"> \ | 86 | <attribute id=\"0x0004\"> \ |
3451 | 92 | <sequence> \ | 87 | <sequence> \ |
3452 | 93 | <sequence> \ | 88 | <sequence> \ |
3453 | 94 | <uuid value=\"0x0100\"/> \ | 89 | <uuid value=\"0x0100\"/> \ |
3454 | 95 | </sequence> \ | 90 | </sequence> \ |
3455 | 96 | <sequence> \ | 91 | <sequence> \ |
3456 | 97 | <uuid value=\"0x0003\"/> \ | 92 | <uuid value=\"0x0003\"/> \ |
3457 | 98 | <uint8 value=\"%u\" name=\"channel\"/> \ | 93 | <uint8 value=\"%u\" name=\"channel\"/> \ |
3458 | 99 | </sequence> \ | 94 | </sequence> \ |
3459 | 100 | <sequence> \ | 95 | <sequence> \ |
3460 | 101 | <uuid value=\"0x0008\"/> \ | 96 | <uuid value=\"0x0008\"/> \ |
3461 | 102 | </sequence> \ | 97 | </sequence> \ |
3462 | 103 | </sequence> \ | 98 | </sequence> \ |
3463 | 104 | </attribute> \ | 99 | </attribute> \ |
3464 | 105 | \ | 100 | \ |
3465 | 106 | <attribute id=\"0x0009\"> \ | 101 | <attribute id=\"0x0009\"> \ |
3466 | 107 | <sequence> \ | 102 | <sequence> \ |
3467 | 108 | <sequence> \ | 103 | <sequence> \ |
3468 | 109 | <uuid value=\"0x1130\"/> \ | 104 | <uuid value=\"0x1130\"/> \ |
3469 | 110 | <uint16 value=\"0x0100\" name=\"version\"/> \ | 105 | <uint16 value=\"0x0100\" name=\"version\"/> \ |
3470 | 111 | </sequence> \ | 106 | </sequence> \ |
3471 | 112 | </sequence> \ | 107 | </sequence> \ |
3472 | 113 | </attribute> \ | 108 | </attribute> \ |
3473 | 114 | \ | 109 | \ |
3474 | 115 | <attribute id=\"0x0100\"> \ | 110 | <attribute id=\"0x0100\"> \ |
3475 | 116 | <text value=\"%s\" name=\"name\"/> \ | 111 | <text value=\"%s\" name=\"name\"/> \ |
3476 | 117 | </attribute> \ | 112 | </attribute> \ |
3477 | 118 | \ | 113 | \ |
3478 | 119 | <attribute id=\"0x0314\"> \ | 114 | <attribute id=\"0x0314\"> \ |
3479 | 120 | <uint8 value=\"0x01\"/> \ | 115 | <uint8 value=\"0x01\"/> \ |
3480 | 121 | </attribute> \ | 116 | </attribute> \ |
3481 | 122 | </record>" | 117 | </record>" |
3482 | 123 | 118 | ||
3483 | 124 | struct aparam_header { | 119 | struct aparam_header { |
3487 | 125 | uint8_t tag; | 120 | uint8_t tag; |
3488 | 126 | uint8_t len; | 121 | uint8_t len; |
3489 | 127 | uint8_t val[0]; | 122 | uint8_t val[0]; |
3490 | 128 | } __attribute__ ((packed)); | 123 | } __attribute__ ((packed)); |
3491 | 129 | 124 | ||
3492 | 125 | struct cache { | ||
3493 | 126 | gboolean valid; | ||
3494 | 127 | uint32_t index; | ||
3495 | 128 | char *folder; | ||
3496 | 129 | GSList *entries; | ||
3497 | 130 | }; | ||
3498 | 131 | |||
3499 | 132 | struct cache_entry { | ||
3500 | 133 | uint32_t handle; | ||
3501 | 134 | char *id; | ||
3502 | 135 | char *name; | ||
3503 | 136 | char *sound; | ||
3504 | 137 | char *tel; | ||
3505 | 138 | }; | ||
3506 | 139 | |||
3507 | 130 | struct pbap_session { | 140 | struct pbap_session { |
3508 | 131 | struct obex_session *os; | ||
3509 | 132 | struct apparam_field *params; | 141 | struct apparam_field *params; |
3511 | 133 | gchar *folder; | 142 | char *folder; |
3512 | 143 | uint32_t find_handle; | ||
3513 | 134 | GString *buffer; | 144 | GString *buffer; |
3514 | 145 | struct cache cache; | ||
3515 | 135 | }; | 146 | }; |
3516 | 136 | 147 | ||
3518 | 137 | static const guint8 PBAP_TARGET[TARGET_SIZE] = { | 148 | static const uint8_t PBAP_TARGET[TARGET_SIZE] = { |
3519 | 138 | 0x79, 0x61, 0x35, 0xF0, 0xF0, 0xC5, 0x11, 0xD8, | 149 | 0x79, 0x61, 0x35, 0xF0, 0xF0, 0xC5, 0x11, 0xD8, |
3520 | 139 | 0x09, 0x66, 0x08, 0x00, 0x20, 0x0C, 0x9A, 0x66 }; | 150 | 0x09, 0x66, 0x08, 0x00, 0x20, 0x0C, 0x9A, 0x66 }; |
3521 | 140 | 151 | ||
3530 | 141 | static void set_folder(struct pbap_session *pbap, const char *new_folder) | 152 | typedef int (*cache_entry_find_f) (const struct cache_entry *entry, |
3531 | 142 | { | 153 | const char *value); |
3532 | 143 | g_free(pbap->folder); | 154 | |
3533 | 144 | 155 | static void cache_entry_free(struct cache_entry *entry) | |
3534 | 145 | pbap->folder = new_folder ? g_strdup(new_folder) : NULL; | 156 | { |
3535 | 146 | } | 157 | g_free(entry->id); |
3536 | 147 | 158 | g_free(entry->name); | |
3537 | 148 | static struct apparam_field *parse_aparam(const guint8 *buffer, guint32 hlen) | 159 | g_free(entry->sound); |
3538 | 160 | g_free(entry->tel); | ||
3539 | 161 | g_free(entry); | ||
3540 | 162 | } | ||
3541 | 163 | |||
3542 | 164 | static gboolean entry_name_find(const struct cache_entry *entry, | ||
3543 | 165 | const char *value) | ||
3544 | 166 | { | ||
3545 | 167 | char *name; | ||
3546 | 168 | gboolean ret; | ||
3547 | 169 | |||
3548 | 170 | if (!entry->name) | ||
3549 | 171 | return FALSE; | ||
3550 | 172 | |||
3551 | 173 | if (strlen(value) == 0) | ||
3552 | 174 | return TRUE; | ||
3553 | 175 | |||
3554 | 176 | name = g_utf8_strdown(entry->name, -1); | ||
3555 | 177 | ret = (g_strstr_len(name, -1, value) ? TRUE : FALSE); | ||
3556 | 178 | g_free(name); | ||
3557 | 179 | |||
3558 | 180 | return ret; | ||
3559 | 181 | } | ||
3560 | 182 | |||
3561 | 183 | static gboolean entry_sound_find(const struct cache_entry *entry, | ||
3562 | 184 | const char *value) | ||
3563 | 185 | { | ||
3564 | 186 | if (!entry->sound) | ||
3565 | 187 | return FALSE; | ||
3566 | 188 | |||
3567 | 189 | return (g_strstr_len(entry->sound, -1, value) ? TRUE : FALSE); | ||
3568 | 190 | } | ||
3569 | 191 | |||
3570 | 192 | static gboolean entry_tel_find(const struct cache_entry *entry, | ||
3571 | 193 | const char *value) | ||
3572 | 194 | { | ||
3573 | 195 | if (!entry->tel) | ||
3574 | 196 | return FALSE; | ||
3575 | 197 | |||
3576 | 198 | return (g_strstr_len(entry->tel, -1, value) ? TRUE : FALSE); | ||
3577 | 199 | } | ||
3578 | 200 | |||
3579 | 201 | static const char *cache_find(struct cache *cache, uint32_t handle) | ||
3580 | 202 | { | ||
3581 | 203 | GSList *l; | ||
3582 | 204 | |||
3583 | 205 | for (l = cache->entries; l; l = l->next) { | ||
3584 | 206 | struct cache_entry *entry = l->data; | ||
3585 | 207 | |||
3586 | 208 | if (entry->handle == handle) | ||
3587 | 209 | return entry->id; | ||
3588 | 210 | } | ||
3589 | 211 | |||
3590 | 212 | return NULL; | ||
3591 | 213 | } | ||
3592 | 214 | |||
3593 | 215 | static void cache_clear(struct cache *cache) | ||
3594 | 216 | { | ||
3595 | 217 | g_free(cache->folder); | ||
3596 | 218 | g_slist_foreach(cache->entries, (GFunc) cache_entry_free, NULL); | ||
3597 | 219 | g_slist_free(cache->entries); | ||
3598 | 220 | cache->entries = NULL; | ||
3599 | 221 | } | ||
3600 | 222 | |||
3601 | 223 | static void phonebook_size_result(const char *buffer, size_t bufsize, | ||
3602 | 224 | int vcards, int missed, void *user_data) | ||
3603 | 225 | { | ||
3604 | 226 | struct pbap_session *pbap = user_data; | ||
3605 | 227 | char aparam[4]; | ||
3606 | 228 | struct aparam_header *hdr = (struct aparam_header *) aparam; | ||
3607 | 229 | uint16_t phonebooksize; | ||
3608 | 230 | |||
3609 | 231 | DBG("vcards %d", vcards); | ||
3610 | 232 | |||
3611 | 233 | phonebooksize = htons(vcards); | ||
3612 | 234 | |||
3613 | 235 | hdr->tag = PHONEBOOKSIZE_TAG; | ||
3614 | 236 | hdr->len = PHONEBOOKSIZE_LEN; | ||
3615 | 237 | memcpy(hdr->val, &phonebooksize, sizeof(phonebooksize)); | ||
3616 | 238 | |||
3617 | 239 | pbap->buffer = g_string_new_len(aparam, sizeof(aparam)); | ||
3618 | 240 | |||
3619 | 241 | obex_object_set_io_flags(pbap, G_IO_IN, 0); | ||
3620 | 242 | } | ||
3621 | 243 | |||
3622 | 244 | static void query_result(const char *buffer, size_t bufsize, int vcards, | ||
3623 | 245 | int missed, void *user_data) | ||
3624 | 246 | { | ||
3625 | 247 | struct pbap_session *pbap = user_data; | ||
3626 | 248 | |||
3627 | 249 | DBG(""); | ||
3628 | 250 | |||
3629 | 251 | if (!pbap->buffer) | ||
3630 | 252 | pbap->buffer = g_string_new_len(buffer, bufsize); | ||
3631 | 253 | else | ||
3632 | 254 | pbap->buffer = g_string_append_len(pbap->buffer, buffer, | ||
3633 | 255 | bufsize); | ||
3634 | 256 | |||
3635 | 257 | obex_object_set_io_flags(pbap, G_IO_IN, 0); | ||
3636 | 258 | } | ||
3637 | 259 | |||
3638 | 260 | static void cache_entry_notify(const char *id, uint32_t handle, | ||
3639 | 261 | const char *name, const char *sound, | ||
3640 | 262 | const char *tel, void *user_data) | ||
3641 | 263 | { | ||
3642 | 264 | struct pbap_session *pbap = user_data; | ||
3643 | 265 | struct cache_entry *entry = g_new0(struct cache_entry, 1); | ||
3644 | 266 | struct cache *cache = &pbap->cache; | ||
3645 | 267 | |||
3646 | 268 | if (handle != PHONEBOOK_INVALID_HANDLE) | ||
3647 | 269 | entry->handle = handle; | ||
3648 | 270 | else | ||
3649 | 271 | entry->handle = ++pbap->cache.index; | ||
3650 | 272 | |||
3651 | 273 | entry->id = g_strdup(id); | ||
3652 | 274 | entry->name = g_strdup(name); | ||
3653 | 275 | entry->sound = g_strdup(sound); | ||
3654 | 276 | entry->tel = g_strdup(tel); | ||
3655 | 277 | |||
3656 | 278 | cache->entries = g_slist_append(cache->entries, entry); | ||
3657 | 279 | } | ||
3658 | 280 | |||
3659 | 281 | static int alpha_sort(gconstpointer a, gconstpointer b) | ||
3660 | 282 | { | ||
3661 | 283 | const struct cache_entry *e1 = a; | ||
3662 | 284 | const struct cache_entry *e2 = b; | ||
3663 | 285 | |||
3664 | 286 | return g_strcmp0(e1->name, e2->name); | ||
3665 | 287 | } | ||
3666 | 288 | |||
3667 | 289 | static int indexed_sort(gconstpointer a, gconstpointer b) | ||
3668 | 290 | { | ||
3669 | 291 | const struct cache_entry *e1 = a; | ||
3670 | 292 | const struct cache_entry *e2 = b; | ||
3671 | 293 | |||
3672 | 294 | return (e1->handle - e2->handle); | ||
3673 | 295 | } | ||
3674 | 296 | |||
3675 | 297 | static int phonetical_sort(gconstpointer a, gconstpointer b) | ||
3676 | 298 | { | ||
3677 | 299 | const struct cache_entry *e1 = a; | ||
3678 | 300 | const struct cache_entry *e2 = b; | ||
3679 | 301 | |||
3680 | 302 | /* SOUND attribute is optional. Use Indexed sort if not present. */ | ||
3681 | 303 | if (!e1->sound || !e2->sound) | ||
3682 | 304 | return indexed_sort(a, b); | ||
3683 | 305 | |||
3684 | 306 | return g_strcmp0(e1->sound, e2->sound); | ||
3685 | 307 | } | ||
3686 | 308 | |||
3687 | 309 | static GSList *sort_entries(GSList *l, uint8_t order, uint8_t search_attrib, | ||
3688 | 310 | const char *value) | ||
3689 | 311 | { | ||
3690 | 312 | GSList *sorted = NULL; | ||
3691 | 313 | cache_entry_find_f find; | ||
3692 | 314 | GCompareFunc sort; | ||
3693 | 315 | char *searchval; | ||
3694 | 316 | |||
3695 | 317 | /* | ||
3696 | 318 | * Default sorter is "Indexed". Some backends doesn't inform the index, | ||
3697 | 319 | * for this case a sequential internal index is assigned. | ||
3698 | 320 | * 0x00 = indexed | ||
3699 | 321 | * 0x01 = alphanumeric | ||
3700 | 322 | * 0x02 = phonetic | ||
3701 | 323 | */ | ||
3702 | 324 | switch (order) { | ||
3703 | 325 | case 0x01: | ||
3704 | 326 | sort = alpha_sort; | ||
3705 | 327 | break; | ||
3706 | 328 | case 0x02: | ||
3707 | 329 | sort = phonetical_sort; | ||
3708 | 330 | break; | ||
3709 | 331 | default: | ||
3710 | 332 | sort = indexed_sort; | ||
3711 | 333 | break; | ||
3712 | 334 | } | ||
3713 | 335 | |||
3714 | 336 | /* | ||
3715 | 337 | * This implementation checks if the given field CONTAINS the | ||
3716 | 338 | * search value(case insensitive). Name is the default field | ||
3717 | 339 | * when the attribute is not provided. | ||
3718 | 340 | */ | ||
3719 | 341 | switch (search_attrib) { | ||
3720 | 342 | /* Number */ | ||
3721 | 343 | case 1: | ||
3722 | 344 | find = entry_tel_find; | ||
3723 | 345 | break; | ||
3724 | 346 | /* Sound */ | ||
3725 | 347 | case 2: | ||
3726 | 348 | find = entry_sound_find; | ||
3727 | 349 | break; | ||
3728 | 350 | default: | ||
3729 | 351 | find = entry_name_find; | ||
3730 | 352 | break; | ||
3731 | 353 | } | ||
3732 | 354 | |||
3733 | 355 | searchval = value ? g_utf8_strdown(value, -1) : NULL; | ||
3734 | 356 | for (; l; l = l->next) { | ||
3735 | 357 | struct cache_entry *entry = l->data; | ||
3736 | 358 | |||
3737 | 359 | if (searchval && !find(entry, (const char *) searchval)) | ||
3738 | 360 | continue; | ||
3739 | 361 | |||
3740 | 362 | sorted = g_slist_insert_sorted(sorted, entry, sort); | ||
3741 | 363 | } | ||
3742 | 364 | |||
3743 | 365 | g_free(searchval); | ||
3744 | 366 | |||
3745 | 367 | return sorted; | ||
3746 | 368 | } | ||
3747 | 369 | |||
3748 | 370 | static void cache_ready_notify(void *user_data) | ||
3749 | 371 | { | ||
3750 | 372 | struct pbap_session *pbap = user_data; | ||
3751 | 373 | GSList *sorted; | ||
3752 | 374 | GSList *l; | ||
3753 | 375 | uint16_t max = pbap->params->maxlistcount; | ||
3754 | 376 | |||
3755 | 377 | DBG(""); | ||
3756 | 378 | |||
3757 | 379 | if (max == 0) { | ||
3758 | 380 | /* Ignore all other parameter and return PhoneBookSize */ | ||
3759 | 381 | char aparam[4]; | ||
3760 | 382 | struct aparam_header *hdr = (struct aparam_header *) aparam; | ||
3761 | 383 | uint16_t size = htons(g_slist_length(pbap->cache.entries)); | ||
3762 | 384 | |||
3763 | 385 | hdr->tag = PHONEBOOKSIZE_TAG; | ||
3764 | 386 | hdr->len = PHONEBOOKSIZE_LEN; | ||
3765 | 387 | memcpy(hdr->val, &size, sizeof(size)); | ||
3766 | 388 | |||
3767 | 389 | pbap->buffer = g_string_new_len(aparam, sizeof(aparam)); | ||
3768 | 390 | goto done; | ||
3769 | 391 | } | ||
3770 | 392 | /* | ||
3771 | 393 | * Don't free the sorted list content: this list contains | ||
3772 | 394 | * only the reference for the "real" cache entry. | ||
3773 | 395 | */ | ||
3774 | 396 | sorted = sort_entries(pbap->cache.entries, pbap->params->order, | ||
3775 | 397 | pbap->params->searchattrib, | ||
3776 | 398 | (const char *) pbap->params->searchval); | ||
3777 | 399 | |||
3778 | 400 | /* Computing offset considering first entry of the phonebook */ | ||
3779 | 401 | l = g_slist_nth(sorted, pbap->params->liststartoffset); | ||
3780 | 402 | |||
3781 | 403 | pbap->buffer = g_string_new(VCARD_LISTING_BEGIN); | ||
3782 | 404 | for (; l && max; l = l->next, max--) { | ||
3783 | 405 | const struct cache_entry *entry = l->data; | ||
3784 | 406 | |||
3785 | 407 | g_string_append_printf(pbap->buffer, VCARD_LISTING_ELEMENT, | ||
3786 | 408 | entry->handle, entry->name); | ||
3787 | 409 | } | ||
3788 | 410 | |||
3789 | 411 | pbap->buffer = g_string_append(pbap->buffer, VCARD_LISTING_END); | ||
3790 | 412 | |||
3791 | 413 | g_slist_free(sorted); | ||
3792 | 414 | |||
3793 | 415 | done: | ||
3794 | 416 | if (!pbap->cache.valid) { | ||
3795 | 417 | pbap->cache.valid = TRUE; | ||
3796 | 418 | obex_object_set_io_flags(pbap, G_IO_IN, 0); | ||
3797 | 419 | } | ||
3798 | 420 | } | ||
3799 | 421 | |||
3800 | 422 | static void cache_entry_done(void *user_data) | ||
3801 | 423 | { | ||
3802 | 424 | struct pbap_session *pbap = user_data; | ||
3803 | 425 | const char *id; | ||
3804 | 426 | int ret; | ||
3805 | 427 | |||
3806 | 428 | DBG(""); | ||
3807 | 429 | |||
3808 | 430 | pbap->cache.valid = TRUE; | ||
3809 | 431 | |||
3810 | 432 | id = cache_find(&pbap->cache, pbap->find_handle); | ||
3811 | 433 | if (id == NULL) { | ||
3812 | 434 | debug("Entry %d not found on cache", pbap->find_handle); | ||
3813 | 435 | obex_object_set_io_flags(pbap, G_IO_ERR, -ENOENT); | ||
3814 | 436 | return; | ||
3815 | 437 | } | ||
3816 | 438 | |||
3817 | 439 | ret = phonebook_get_entry(pbap->folder, id, pbap->params, | ||
3818 | 440 | query_result, pbap); | ||
3819 | 441 | if (ret < 0) | ||
3820 | 442 | obex_object_set_io_flags(pbap, G_IO_ERR, ret); | ||
3821 | 443 | } | ||
3822 | 444 | |||
3823 | 445 | static struct apparam_field *parse_aparam(const uint8_t *buffer, uint32_t hlen) | ||
3824 | 149 | { | 446 | { |
3825 | 150 | struct apparam_field *param; | 447 | struct apparam_field *param; |
3826 | 151 | struct aparam_header *hdr; | 448 | struct aparam_header *hdr; |
3830 | 152 | guint32 len = 0; | 449 | uint64_t val64; |
3831 | 153 | guint16 val16; | 450 | uint32_t len = 0; |
3832 | 154 | guint64 val64; | 451 | uint16_t val16; |
3833 | 155 | 452 | ||
3834 | 156 | param = g_new0(struct apparam_field, 1); | 453 | param = g_new0(struct apparam_field, 1); |
3835 | 157 | 454 | ||
3836 | @@ -173,6 +470,9 @@ | |||
3837 | 173 | param->searchattrib = hdr->val[0]; | 470 | param->searchattrib = hdr->val[0]; |
3838 | 174 | break; | 471 | break; |
3839 | 175 | case SEARCHVALUE_TAG: | 472 | case SEARCHVALUE_TAG: |
3840 | 473 | if (hdr->len == 0) | ||
3841 | 474 | goto failed; | ||
3842 | 475 | |||
3843 | 176 | param->searchval = g_try_malloc0(hdr->len + 1); | 476 | param->searchval = g_try_malloc0(hdr->len + 1); |
3844 | 177 | if (param->searchval) | 477 | if (param->searchval) |
3845 | 178 | memcpy(param->searchval, hdr->val, hdr->len); | 478 | memcpy(param->searchval, hdr->val, hdr->len); |
3846 | @@ -212,6 +512,11 @@ | |||
3847 | 212 | len += hdr->len + sizeof(struct aparam_header); | 512 | len += hdr->len + sizeof(struct aparam_header); |
3848 | 213 | } | 513 | } |
3849 | 214 | 514 | ||
3850 | 515 | DBG("o %x sa %x sv %s fil %" G_GINT64_MODIFIER "x for %x max %x off %x", | ||
3851 | 516 | param->order, param->searchattrib, param->searchval, | ||
3852 | 517 | param->filter, param->format, param->maxlistcount, | ||
3853 | 518 | param->liststartoffset); | ||
3854 | 519 | |||
3855 | 215 | return param; | 520 | return param; |
3856 | 216 | 521 | ||
3857 | 217 | failed: | 522 | failed: |
3858 | @@ -220,7 +525,7 @@ | |||
3859 | 220 | return NULL; | 525 | return NULL; |
3860 | 221 | } | 526 | } |
3861 | 222 | 527 | ||
3863 | 223 | static gpointer pbap_connect(struct obex_session *os, int *err) | 528 | static void *pbap_connect(struct obex_session *os, int *err) |
3864 | 224 | { | 529 | { |
3865 | 225 | struct pbap_session *pbap; | 530 | struct pbap_session *pbap; |
3866 | 226 | 531 | ||
3867 | @@ -228,7 +533,7 @@ | |||
3868 | 228 | 533 | ||
3869 | 229 | pbap = g_new0(struct pbap_session, 1); | 534 | pbap = g_new0(struct pbap_session, 1); |
3870 | 230 | pbap->folder = g_strdup("/"); | 535 | pbap->folder = g_strdup("/"); |
3872 | 231 | pbap->os = os; | 536 | pbap->find_handle = PHONEBOOK_INVALID_HANDLE; |
3873 | 232 | 537 | ||
3874 | 233 | if (err) | 538 | if (err) |
3875 | 234 | *err = 0; | 539 | *err = 0; |
3876 | @@ -237,24 +542,42 @@ | |||
3877 | 237 | } | 542 | } |
3878 | 238 | 543 | ||
3879 | 239 | static int pbap_get(struct obex_session *os, obex_object_t *obj, | 544 | static int pbap_get(struct obex_session *os, obex_object_t *obj, |
3881 | 240 | gpointer user_data) | 545 | gboolean *stream, void *user_data) |
3882 | 241 | { | 546 | { |
3883 | 242 | struct pbap_session *pbap = user_data; | 547 | struct pbap_session *pbap = user_data; |
3886 | 243 | const gchar *type = obex_get_type(os); | 548 | const char *type = obex_get_type(os); |
3887 | 244 | const gchar *name = obex_get_name(os); | 549 | const char *name = obex_get_name(os); |
3888 | 245 | struct apparam_field *params; | 550 | struct apparam_field *params; |
3891 | 246 | const guint8 *buffer; | 551 | const uint8_t *buffer; |
3892 | 247 | gchar *path; | 552 | char *path; |
3893 | 248 | ssize_t rsize; | 553 | ssize_t rsize; |
3895 | 249 | gint ret; | 554 | int ret; |
3896 | 555 | |||
3897 | 556 | DBG("name %s type %s pbap %p", name, type, pbap); | ||
3898 | 250 | 557 | ||
3899 | 251 | if (type == NULL) | 558 | if (type == NULL) |
3900 | 252 | return -EBADR; | 559 | return -EBADR; |
3901 | 253 | 560 | ||
3903 | 254 | if (strcmp(type, PHONEBOOK_TYPE) == 0) | 561 | rsize = obex_aparam_read(os, obj, &buffer); |
3904 | 562 | if (rsize < 0) | ||
3905 | 563 | return -EBADR; | ||
3906 | 564 | |||
3907 | 565 | params = parse_aparam(buffer, rsize); | ||
3908 | 566 | if (params == NULL) | ||
3909 | 567 | return -EBADR; | ||
3910 | 568 | |||
3911 | 569 | if (pbap->params) { | ||
3912 | 570 | g_free(pbap->params->searchval); | ||
3913 | 571 | g_free(pbap->params); | ||
3914 | 572 | } | ||
3915 | 573 | |||
3916 | 574 | pbap->params = params; | ||
3917 | 575 | |||
3918 | 576 | if (strcmp(type, PHONEBOOK_TYPE) == 0) { | ||
3919 | 255 | /* Always contains the absolute path */ | 577 | /* Always contains the absolute path */ |
3920 | 256 | path = g_strdup(name); | 578 | path = g_strdup(name); |
3922 | 257 | else if (strcmp(type, VCARDLISTING_TYPE) == 0) | 579 | *stream = (params->maxlistcount == 0 ? FALSE : TRUE); |
3923 | 580 | } else if (strcmp(type, VCARDLISTING_TYPE) == 0) { | ||
3924 | 258 | /* Always relative */ | 581 | /* Always relative */ |
3925 | 259 | if (!name || strlen(name) == 0) | 582 | if (!name || strlen(name) == 0) |
3926 | 260 | /* Current folder */ | 583 | /* Current folder */ |
3927 | @@ -263,47 +586,30 @@ | |||
3928 | 263 | /* Current folder + relative path */ | 586 | /* Current folder + relative path */ |
3929 | 264 | path = g_build_filename(pbap->folder, name, NULL); | 587 | path = g_build_filename(pbap->folder, name, NULL); |
3930 | 265 | 588 | ||
3935 | 266 | else if (strcmp(type, VCARDENTRY_TYPE) == 0) | 589 | *stream = (params->maxlistcount == 0 ? FALSE : TRUE); |
3936 | 267 | /* Always relative */ | 590 | } else if (strcmp(type, VCARDENTRY_TYPE) == 0) { |
3937 | 268 | path = g_build_filename(pbap->folder, name, NULL); | 591 | /* File name only */ |
3938 | 269 | else | 592 | path = g_strdup(name); |
3939 | 593 | *stream = TRUE; | ||
3940 | 594 | } else | ||
3941 | 270 | return -EBADR; | 595 | return -EBADR; |
3942 | 271 | 596 | ||
3943 | 272 | rsize = obex_aparam_read(os, obj, &buffer); | ||
3944 | 273 | if (rsize < 0) { | ||
3945 | 274 | ret = -EBADR; | ||
3946 | 275 | goto failed; | ||
3947 | 276 | } | ||
3948 | 277 | |||
3949 | 278 | params = parse_aparam(buffer, rsize); | ||
3950 | 279 | if (params == NULL) { | ||
3951 | 280 | ret = -EBADR; | ||
3952 | 281 | goto failed; | ||
3953 | 282 | } | ||
3954 | 283 | |||
3955 | 284 | if (pbap->params) { | ||
3956 | 285 | g_free(pbap->params->searchval); | ||
3957 | 286 | g_free(pbap->params); | ||
3958 | 287 | } | ||
3959 | 288 | |||
3960 | 289 | pbap->params = params; | 597 | pbap->params = params; |
3962 | 290 | ret = obex_stream_start(os, path, pbap); | 598 | ret = obex_get_stream_start(os, path); |
3963 | 291 | 599 | ||
3964 | 292 | failed: | ||
3965 | 293 | g_free(path); | 600 | g_free(path); |
3966 | 294 | 601 | ||
3967 | 295 | return ret; | 602 | return ret; |
3968 | 296 | } | 603 | } |
3969 | 297 | 604 | ||
3970 | 298 | |||
3971 | 299 | static int pbap_setpath(struct obex_session *os, obex_object_t *obj, | 605 | static int pbap_setpath(struct obex_session *os, obex_object_t *obj, |
3973 | 300 | gpointer user_data) | 606 | void *user_data) |
3974 | 301 | { | 607 | { |
3975 | 302 | struct pbap_session *pbap = user_data; | 608 | struct pbap_session *pbap = user_data; |
3980 | 303 | const gchar *name; | 609 | const char *name; |
3981 | 304 | guint8 *nonhdr; | 610 | uint8_t *nonhdr; |
3982 | 305 | gchar *fullname; | 611 | char *fullname; |
3983 | 306 | int ret; | 612 | int err; |
3984 | 307 | 613 | ||
3985 | 308 | if (OBEX_ObjectGetNonHdrData(obj, &nonhdr) != 2) { | 614 | if (OBEX_ObjectGetNonHdrData(obj, &nonhdr) != 2) { |
3986 | 309 | error("Set path failed: flag and constants not found!"); | 615 | error("Set path failed: flag and constants not found!"); |
3987 | @@ -312,24 +618,27 @@ | |||
3988 | 312 | 618 | ||
3989 | 313 | name = obex_get_name(os); | 619 | name = obex_get_name(os); |
3990 | 314 | 620 | ||
4003 | 315 | ret = phonebook_set_folder(pbap->folder, name, nonhdr[0]); | 621 | DBG("name %s folder %s nonhdr 0x%x%x", name, pbap->folder, |
4004 | 316 | if (ret < 0) | 622 | nonhdr[0], nonhdr[1]); |
4005 | 317 | return ret; | 623 | |
4006 | 318 | 624 | fullname = phonebook_set_folder(pbap->folder, name, nonhdr[0], &err); | |
4007 | 319 | if (!pbap->folder) | 625 | if (err < 0) |
4008 | 320 | fullname = g_strdup(name); | 626 | return err; |
4009 | 321 | else | 627 | |
4010 | 322 | fullname = g_build_filename(pbap->folder, name, NULL); | 628 | g_free(pbap->folder); |
4011 | 323 | 629 | pbap->folder = fullname; | |
4012 | 324 | set_folder(pbap, fullname); | 630 | |
4013 | 325 | 631 | /* | |
4014 | 326 | g_free(fullname); | 632 | * FIXME: Define a criteria to mark the cache as invalid |
4015 | 633 | */ | ||
4016 | 634 | pbap->cache.valid = FALSE; | ||
4017 | 635 | pbap->cache.index = 0; | ||
4018 | 636 | cache_clear(&pbap->cache); | ||
4019 | 327 | 637 | ||
4020 | 328 | return 0; | 638 | return 0; |
4021 | 329 | } | 639 | } |
4022 | 330 | 640 | ||
4025 | 331 | static void pbap_disconnect(struct obex_session *os, | 641 | static void pbap_disconnect(struct obex_session *os, void *user_data) |
4024 | 332 | gpointer user_data) | ||
4026 | 333 | { | 642 | { |
4027 | 334 | struct pbap_session *pbap = user_data; | 643 | struct pbap_session *pbap = user_data; |
4028 | 335 | 644 | ||
4029 | @@ -340,18 +649,18 @@ | |||
4030 | 340 | g_free(pbap->params); | 649 | g_free(pbap->params); |
4031 | 341 | } | 650 | } |
4032 | 342 | 651 | ||
4033 | 652 | cache_clear(&pbap->cache); | ||
4034 | 343 | g_free(pbap->folder); | 653 | g_free(pbap->folder); |
4035 | 344 | g_free(pbap); | 654 | g_free(pbap); |
4036 | 345 | } | 655 | } |
4037 | 346 | 656 | ||
4040 | 347 | static gint pbap_chkput(struct obex_session *os, | 657 | static int pbap_chkput(struct obex_session *os, void *user_data) |
4039 | 348 | gpointer user_data) | ||
4041 | 349 | { | 658 | { |
4042 | 350 | /* Rejects all PUTs */ | 659 | /* Rejects all PUTs */ |
4044 | 351 | return -EINVAL; | 660 | return -EBADR; |
4045 | 352 | } | 661 | } |
4046 | 353 | 662 | ||
4048 | 354 | struct obex_service_driver pbap = { | 663 | static struct obex_service_driver pbap = { |
4049 | 355 | .name = "Phonebook Access server", | 664 | .name = "Phonebook Access server", |
4050 | 356 | .service = OBEX_PBAP, | 665 | .service = OBEX_PBAP, |
4051 | 357 | .channel = PBAP_CHANNEL, | 666 | .channel = PBAP_CHANNEL, |
4052 | @@ -365,57 +674,189 @@ | |||
4053 | 365 | .chkput = pbap_chkput | 674 | .chkput = pbap_chkput |
4054 | 366 | }; | 675 | }; |
4055 | 367 | 676 | ||
4107 | 368 | static void query_result(const gchar *buffer, size_t bufsize, | 677 | static void *vobject_pull_open(const char *name, int oflag, mode_t mode, |
4108 | 369 | gint vcards, gint missed, gpointer user_data) | 678 | void *context, size_t *size, int *err) |
4109 | 370 | { | 679 | { |
4110 | 371 | struct pbap_session *pbap = user_data; | 680 | struct pbap_session *pbap = context; |
4111 | 372 | 681 | phonebook_cb cb; | |
4112 | 373 | if (!pbap->buffer) | 682 | int ret; |
4113 | 374 | pbap->buffer = g_string_new_len(buffer, bufsize); | 683 | |
4114 | 375 | else | 684 | DBG("name %s context %p maxlistcount %d", name, context, |
4115 | 376 | pbap->buffer = g_string_append_len(pbap->buffer, buffer, bufsize); | 685 | pbap->params->maxlistcount); |
4116 | 377 | 686 | ||
4117 | 378 | obex_object_set_io_flags(pbap, G_IO_IN, 0); | 687 | if (oflag != O_RDONLY) { |
4118 | 379 | } | 688 | ret = -EPERM; |
4119 | 380 | 689 | goto fail; | |
4120 | 381 | static gpointer vobject_open(const char *name, int oflag, mode_t mode, | 690 | } |
4121 | 382 | gpointer context, size_t *size, int *err) | 691 | |
4122 | 383 | { | 692 | if (pbap->params->maxlistcount == 0) |
4123 | 384 | struct pbap_session *pbap = context; | 693 | cb = phonebook_size_result; |
4124 | 385 | int ret; | 694 | else |
4125 | 386 | 695 | cb = query_result; | |
4126 | 387 | if (oflag != O_RDONLY) { | 696 | |
4127 | 388 | ret = -EPERM; | 697 | ret = phonebook_pull(name, pbap->params, cb, pbap); |
4128 | 389 | goto fail; | 698 | if (ret < 0) |
4129 | 390 | } | 699 | goto fail; |
4130 | 391 | 700 | ||
4131 | 392 | ret = phonebook_pull(name, pbap->params, query_result, pbap); | 701 | if (size) |
4132 | 393 | if (ret < 0) | 702 | *size = OBJECT_SIZE_UNKNOWN; |
4133 | 394 | goto fail; | 703 | |
4134 | 395 | 704 | return pbap; | |
4135 | 396 | if (size) | 705 | |
4136 | 397 | *size = OBJECT_SIZE_UNKNOWN; | 706 | fail: |
4137 | 398 | 707 | if (err) | |
4138 | 399 | return pbap; | 708 | *err = ret; |
4139 | 400 | 709 | ||
4140 | 401 | fail: | 710 | return NULL; |
4141 | 402 | if (err) | 711 | } |
4142 | 403 | *err = ret; | 712 | |
4143 | 404 | 713 | static void *vobject_list_open(const char *name, int oflag, mode_t mode, | |
4144 | 405 | return NULL; | 714 | void *context, size_t *size, int *err) |
4145 | 406 | } | 715 | { |
4146 | 407 | 716 | struct pbap_session *pbap = context; | |
4147 | 408 | static ssize_t vobject_read(gpointer object, void *buf, size_t count) | 717 | int ret; |
4148 | 409 | { | 718 | |
4149 | 410 | struct pbap_session *pbap = object; | 719 | DBG("name %s context %p valid %d", name, context, pbap->cache.valid); |
4150 | 411 | 720 | ||
4151 | 412 | if (pbap->buffer) | 721 | if (oflag != O_RDONLY) { |
4152 | 413 | return string_read(pbap->buffer, buf, count); | 722 | ret = -EPERM; |
4153 | 414 | 723 | goto fail; | |
4154 | 415 | return -EAGAIN; | 724 | } |
4155 | 416 | } | 725 | |
4156 | 417 | 726 | /* PullvCardListing always get the contacts from the cache */ | |
4157 | 418 | static int vobject_close(gpointer object) | 727 | |
4158 | 728 | if (pbap->cache.valid) { | ||
4159 | 729 | cache_ready_notify(pbap); | ||
4160 | 730 | goto done; | ||
4161 | 731 | } | ||
4162 | 732 | |||
4163 | 733 | ret = phonebook_create_cache(name, | ||
4164 | 734 | cache_entry_notify, cache_ready_notify, pbap); | ||
4165 | 735 | |||
4166 | 736 | if (ret < 0) | ||
4167 | 737 | goto fail; | ||
4168 | 738 | |||
4169 | 739 | done: | ||
4170 | 740 | if (size) | ||
4171 | 741 | *size = OBJECT_SIZE_UNKNOWN; | ||
4172 | 742 | |||
4173 | 743 | return pbap; | ||
4174 | 744 | |||
4175 | 745 | fail: | ||
4176 | 746 | if (err) | ||
4177 | 747 | *err = ret; | ||
4178 | 748 | |||
4179 | 749 | return NULL; | ||
4180 | 750 | } | ||
4181 | 751 | |||
4182 | 752 | static void *vobject_vcard_open(const char *name, int oflag, mode_t mode, | ||
4183 | 753 | void *context, size_t *size, int *err) | ||
4184 | 754 | { | ||
4185 | 755 | struct pbap_session *pbap = context; | ||
4186 | 756 | const char *id; | ||
4187 | 757 | uint32_t handle; | ||
4188 | 758 | int ret; | ||
4189 | 759 | |||
4190 | 760 | DBG("name %s context %p valid %d", name, context, pbap->cache.valid); | ||
4191 | 761 | |||
4192 | 762 | if (oflag != O_RDONLY) { | ||
4193 | 763 | ret = -EPERM; | ||
4194 | 764 | goto fail; | ||
4195 | 765 | } | ||
4196 | 766 | |||
4197 | 767 | if (sscanf(name, "%u.vcf", &handle) != 1) { | ||
4198 | 768 | ret = -EBADR; | ||
4199 | 769 | goto fail; | ||
4200 | 770 | } | ||
4201 | 771 | |||
4202 | 772 | if (pbap->cache.valid == FALSE) { | ||
4203 | 773 | pbap->find_handle = handle; | ||
4204 | 774 | ret = phonebook_create_cache(pbap->folder, cache_entry_notify, | ||
4205 | 775 | cache_entry_done, pbap); | ||
4206 | 776 | goto done; | ||
4207 | 777 | } | ||
4208 | 778 | |||
4209 | 779 | id = cache_find(&pbap->cache, handle); | ||
4210 | 780 | if (!id) { | ||
4211 | 781 | ret = -ENOENT; | ||
4212 | 782 | goto fail; | ||
4213 | 783 | } | ||
4214 | 784 | |||
4215 | 785 | ret = phonebook_get_entry(pbap->folder, id, pbap->params, query_result, | ||
4216 | 786 | pbap); | ||
4217 | 787 | |||
4218 | 788 | done: | ||
4219 | 789 | if (ret < 0) | ||
4220 | 790 | goto fail; | ||
4221 | 791 | |||
4222 | 792 | if (size) | ||
4223 | 793 | *size = OBJECT_SIZE_UNKNOWN; | ||
4224 | 794 | |||
4225 | 795 | return pbap; | ||
4226 | 796 | |||
4227 | 797 | fail: | ||
4228 | 798 | if (err) | ||
4229 | 799 | *err = ret; | ||
4230 | 800 | |||
4231 | 801 | return NULL; | ||
4232 | 802 | } | ||
4233 | 803 | |||
4234 | 804 | static ssize_t vobject_pull_read(void *object, void *buf, size_t count, | ||
4235 | 805 | uint8_t *hi) | ||
4236 | 806 | { | ||
4237 | 807 | struct pbap_session *pbap = object; | ||
4238 | 808 | |||
4239 | 809 | DBG("buffer %p maxlistcount %d", pbap->buffer, | ||
4240 | 810 | pbap->params->maxlistcount); | ||
4241 | 811 | |||
4242 | 812 | if (!pbap->buffer) | ||
4243 | 813 | return -EAGAIN; | ||
4244 | 814 | |||
4245 | 815 | /* PhoneBookSize */ | ||
4246 | 816 | if (pbap->params->maxlistcount == 0) | ||
4247 | 817 | *hi = OBEX_HDR_APPARAM; | ||
4248 | 818 | else | ||
4249 | 819 | /* Stream data */ | ||
4250 | 820 | *hi = OBEX_HDR_BODY; | ||
4251 | 821 | |||
4252 | 822 | return string_read(pbap->buffer, buf, count); | ||
4253 | 823 | } | ||
4254 | 824 | |||
4255 | 825 | static ssize_t vobject_list_read(void *object, void *buf, size_t count, | ||
4256 | 826 | uint8_t *hi) | ||
4257 | 827 | { | ||
4258 | 828 | struct pbap_session *pbap = object; | ||
4259 | 829 | |||
4260 | 830 | DBG("valid %d maxlistcount %d", pbap->cache.valid, | ||
4261 | 831 | pbap->params->maxlistcount); | ||
4262 | 832 | |||
4263 | 833 | /* Backend still busy reading contacts */ | ||
4264 | 834 | if (!pbap->cache.valid) | ||
4265 | 835 | return -EAGAIN; | ||
4266 | 836 | |||
4267 | 837 | if (pbap->params->maxlistcount == 0) | ||
4268 | 838 | *hi = OBEX_HDR_APPARAM; | ||
4269 | 839 | else | ||
4270 | 840 | *hi = OBEX_HDR_BODY; | ||
4271 | 841 | |||
4272 | 842 | return string_read(pbap->buffer, buf, count); | ||
4273 | 843 | } | ||
4274 | 844 | |||
4275 | 845 | static ssize_t vobject_vcard_read(void *object, void *buf, size_t count, | ||
4276 | 846 | uint8_t *hi) | ||
4277 | 847 | { | ||
4278 | 848 | struct pbap_session *pbap = object; | ||
4279 | 849 | |||
4280 | 850 | DBG("buffer %p", pbap->buffer); | ||
4281 | 851 | |||
4282 | 852 | if (!pbap->buffer) | ||
4283 | 853 | return -EAGAIN; | ||
4284 | 854 | |||
4285 | 855 | *hi = OBEX_HDR_BODY; | ||
4286 | 856 | return string_read(pbap->buffer, buf, count); | ||
4287 | 857 | } | ||
4288 | 858 | |||
4289 | 859 | static int vobject_close(void *object) | ||
4290 | 419 | { | 860 | { |
4291 | 420 | struct pbap_session *pbap = object; | 861 | struct pbap_session *pbap = object; |
4292 | 421 | 862 | ||
4293 | @@ -427,28 +868,28 @@ | |||
4294 | 427 | return 0; | 868 | return 0; |
4295 | 428 | } | 869 | } |
4296 | 429 | 870 | ||
4319 | 430 | struct obex_mime_type_driver mime_pull = { | 871 | static struct obex_mime_type_driver mime_pull = { |
4320 | 431 | .target = PBAP_TARGET, | 872 | .target = PBAP_TARGET, |
4321 | 432 | .mimetype = "x-bt/phonebook", | 873 | .mimetype = "x-bt/phonebook", |
4322 | 433 | .open = vobject_open, | 874 | .open = vobject_pull_open, |
4323 | 434 | .close = vobject_close, | 875 | .close = vobject_close, |
4324 | 435 | .read = vobject_read, | 876 | .read = vobject_pull_read, |
4325 | 436 | }; | 877 | }; |
4326 | 437 | 878 | ||
4327 | 438 | struct obex_mime_type_driver mime_list = { | 879 | static struct obex_mime_type_driver mime_list = { |
4328 | 439 | .target = PBAP_TARGET, | 880 | .target = PBAP_TARGET, |
4329 | 440 | .mimetype = "x-bt/vcard-listing", | 881 | .mimetype = "x-bt/vcard-listing", |
4330 | 441 | .open = vobject_open, | 882 | .open = vobject_list_open, |
4331 | 442 | .close = vobject_close, | 883 | .close = vobject_close, |
4332 | 443 | .read = vobject_read, | 884 | .read = vobject_list_read, |
4333 | 444 | }; | 885 | }; |
4334 | 445 | 886 | ||
4335 | 446 | struct obex_mime_type_driver mime_vcard = { | 887 | static struct obex_mime_type_driver mime_vcard = { |
4336 | 447 | .target = PBAP_TARGET, | 888 | .target = PBAP_TARGET, |
4337 | 448 | .mimetype = "x-bt/vcard", | 889 | .mimetype = "x-bt/vcard", |
4338 | 449 | .open = vobject_open, | 890 | .open = vobject_vcard_open, |
4339 | 450 | .close = vobject_close, | 891 | .close = vobject_close, |
4340 | 451 | .read = vobject_read, | 892 | .read = vobject_vcard_read, |
4341 | 452 | }; | 893 | }; |
4342 | 453 | 894 | ||
4343 | 454 | static int pbap_init(void) | 895 | static int pbap_init(void) |
4344 | 455 | 896 | ||
4345 | === modified file 'plugins/phonebook-dummy.c' | |||
4346 | --- plugins/phonebook-dummy.c 2010-04-27 04:17:15 +0000 | |||
4347 | +++ plugins/phonebook-dummy.c 2010-06-15 19:18:33 +0000 | |||
4348 | @@ -26,61 +26,513 @@ | |||
4349 | 26 | #include <config.h> | 26 | #include <config.h> |
4350 | 27 | #endif | 27 | #endif |
4351 | 28 | 28 | ||
4352 | 29 | #include <dirent.h> | ||
4353 | 30 | #include <errno.h> | ||
4354 | 31 | #include <stdio.h> | ||
4355 | 32 | #include <stdint.h> | ||
4356 | 29 | #include <string.h> | 33 | #include <string.h> |
4357 | 30 | #include <glib.h> | 34 | #include <glib.h> |
4358 | 35 | #include <stdlib.h> | ||
4359 | 36 | #include <sys/types.h> | ||
4360 | 37 | #include <sys/stat.h> | ||
4361 | 38 | #include <fcntl.h> | ||
4362 | 39 | #include <unistd.h> | ||
4363 | 40 | #include <libical/ical.h> | ||
4364 | 41 | #include <libical/vobject.h> | ||
4365 | 42 | #include <libical/vcc.h> | ||
4366 | 31 | 43 | ||
4367 | 32 | #include "logging.h" | 44 | #include "logging.h" |
4368 | 33 | #include "phonebook.h" | 45 | #include "phonebook.h" |
4369 | 34 | 46 | ||
4377 | 35 | #define VCARD0 \ | 47 | typedef void (*vcard_func_t) (const char *file, VObject *vo, void *user_data); |
4371 | 36 | "BEGIN:VCARD\n" \ | ||
4372 | 37 | "VERSION:3.0\n" \ | ||
4373 | 38 | "N:Klaus;Santa\n" \ | ||
4374 | 39 | "FN:\n" \ | ||
4375 | 40 | "TEL:+001122334455\n" \ | ||
4376 | 41 | "END:VCARD\n" | ||
4378 | 42 | 48 | ||
4379 | 43 | struct dummy_data { | 49 | struct dummy_data { |
4382 | 44 | phonebook_cb cb; | 50 | phonebook_cb cb; |
4383 | 45 | gpointer user_data; | 51 | void *user_data; |
4384 | 46 | const struct apparam_field *apparams; | 52 | const struct apparam_field *apparams; |
4386 | 47 | }; | 53 | char *folder; |
4387 | 54 | int fd; | ||
4388 | 55 | }; | ||
4389 | 56 | |||
4390 | 57 | struct cache_query { | ||
4391 | 58 | phonebook_entry_cb entry_cb; | ||
4392 | 59 | phonebook_cache_ready_cb ready_cb; | ||
4393 | 60 | void *user_data; | ||
4394 | 61 | DIR *dp; | ||
4395 | 62 | }; | ||
4396 | 63 | |||
4397 | 64 | static char *root_folder = NULL; | ||
4398 | 65 | |||
4399 | 66 | static void dummy_free(void *user_data) | ||
4400 | 67 | { | ||
4401 | 68 | struct dummy_data *dummy = user_data; | ||
4402 | 69 | |||
4403 | 70 | if (dummy->fd >= 0) | ||
4404 | 71 | close(dummy->fd); | ||
4405 | 72 | |||
4406 | 73 | g_free(dummy->folder); | ||
4407 | 74 | g_free(dummy); | ||
4408 | 75 | } | ||
4409 | 76 | |||
4410 | 77 | static void query_free(void *user_data) | ||
4411 | 78 | { | ||
4412 | 79 | struct cache_query *query = user_data; | ||
4413 | 80 | |||
4414 | 81 | if (query->dp) | ||
4415 | 82 | closedir(query->dp); | ||
4416 | 83 | |||
4417 | 84 | g_free(query); | ||
4418 | 85 | } | ||
4419 | 48 | 86 | ||
4420 | 49 | int phonebook_init(void) | 87 | int phonebook_init(void) |
4421 | 50 | { | 88 | { |
4422 | 89 | /* FIXME: It should NOT be hard-coded */ | ||
4423 | 90 | root_folder = g_build_filename(getenv("HOME"), "phonebook", NULL); | ||
4424 | 91 | |||
4425 | 51 | return 0; | 92 | return 0; |
4426 | 52 | } | 93 | } |
4427 | 53 | 94 | ||
4428 | 54 | void phonebook_exit(void) | 95 | void phonebook_exit(void) |
4429 | 55 | { | 96 | { |
4459 | 56 | } | 97 | g_free(root_folder); |
4460 | 57 | 98 | } | |
4461 | 58 | static gboolean dummy_result(gpointer data) | 99 | |
4462 | 59 | { | 100 | static int handle_cmp(gconstpointer a, gconstpointer b) |
4463 | 60 | struct dummy_data *dummy = data; | 101 | { |
4464 | 61 | 102 | const char *f1 = a; | |
4465 | 62 | dummy->cb(VCARD0, strlen(VCARD0), 1, 0, dummy->user_data); | 103 | const char *f2 = b; |
4466 | 63 | 104 | unsigned int i1, i2; | |
4467 | 64 | return FALSE; | 105 | |
4468 | 65 | } | 106 | if (sscanf(f1, "%u.vcf", &i1) != 1) |
4469 | 66 | 107 | return -1; | |
4470 | 67 | int phonebook_set_folder(const gchar *current_folder, | 108 | |
4471 | 68 | const gchar *new_folder, guint8 flags) | 109 | if (sscanf(f2, "%u.vcf", &i2) != 1) |
4472 | 69 | { | 110 | return -1; |
4473 | 70 | return 0; | 111 | |
4474 | 71 | } | 112 | return (i1 - i2); |
4475 | 72 | 113 | } | |
4476 | 73 | int phonebook_pull(const gchar *name, const struct apparam_field *params, | 114 | |
4477 | 74 | phonebook_cb cb, gpointer user_data) | 115 | static int foreach_vcard(DIR *dp, vcard_func_t func, uint16_t offset, |
4478 | 75 | { | 116 | uint16_t maxlistcount, void *user_data, uint16_t *count) |
4479 | 76 | struct dummy_data *dummy; | 117 | { |
4480 | 77 | 118 | struct dirent *ep; | |
4481 | 78 | dummy = g_new0(struct dummy_data, 1); | 119 | GSList *sorted = NULL, *l; |
4482 | 79 | dummy->cb = cb; | 120 | VObject *v; |
4483 | 80 | dummy->user_data = user_data; | 121 | FILE *fp; |
4484 | 81 | dummy->apparams = params; | 122 | int err, fd, folderfd; |
4485 | 82 | 123 | uint16_t n = 0; | |
4486 | 83 | g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, | 124 | |
4487 | 84 | dummy_result, dummy, g_free); | 125 | folderfd = dirfd(dp); |
4488 | 126 | if (folderfd < 0) { | ||
4489 | 127 | err = errno; | ||
4490 | 128 | error("dirfd(): %s(%d)", strerror(err), err); | ||
4491 | 129 | return -err; | ||
4492 | 130 | } | ||
4493 | 131 | |||
4494 | 132 | /* | ||
4495 | 133 | * Sorting vcards by file name. versionsort is a GNU extension. | ||
4496 | 134 | * The simple sorting function implemented on handle_cmp address | ||
4497 | 135 | * vcards handle only(handle is always a number). This sort function | ||
4498 | 136 | * doesn't address filename started by "0". | ||
4499 | 137 | */ | ||
4500 | 138 | while ((ep = readdir(dp))) { | ||
4501 | 139 | char *filename; | ||
4502 | 140 | |||
4503 | 141 | if (ep->d_name[0] == '.') | ||
4504 | 142 | continue; | ||
4505 | 143 | |||
4506 | 144 | filename = g_filename_to_utf8(ep->d_name, -1, NULL, NULL, NULL); | ||
4507 | 145 | if (filename == NULL) { | ||
4508 | 146 | error("g_filename_to_utf8: invalid filename"); | ||
4509 | 147 | continue; | ||
4510 | 148 | } | ||
4511 | 149 | |||
4512 | 150 | if (!g_str_has_suffix(filename, ".vcf")) { | ||
4513 | 151 | g_free(filename); | ||
4514 | 152 | continue; | ||
4515 | 153 | } | ||
4516 | 154 | |||
4517 | 155 | sorted = g_slist_insert_sorted(sorted, filename, handle_cmp); | ||
4518 | 156 | } | ||
4519 | 157 | |||
4520 | 158 | /* | ||
4521 | 159 | * Filtering only the requested vCards attributes. Offset | ||
4522 | 160 | * shall be based on the first entry of the phonebook. | ||
4523 | 161 | */ | ||
4524 | 162 | for (l = g_slist_nth(sorted, offset); | ||
4525 | 163 | l && n < maxlistcount; l = l->next) { | ||
4526 | 164 | const char *filename = l->data; | ||
4527 | 165 | |||
4528 | 166 | fd = openat(folderfd, filename, O_RDONLY); | ||
4529 | 167 | if (fd < 0) { | ||
4530 | 168 | err = errno; | ||
4531 | 169 | error("openat(%s): %s(%d)", filename, strerror(err), err); | ||
4532 | 170 | continue; | ||
4533 | 171 | } | ||
4534 | 172 | |||
4535 | 173 | fp = fdopen(fd, "r"); | ||
4536 | 174 | v = Parse_MIME_FromFile(fp); | ||
4537 | 175 | if (v != NULL) { | ||
4538 | 176 | func(filename, v, user_data); | ||
4539 | 177 | deleteVObject(v); | ||
4540 | 178 | n++; | ||
4541 | 179 | } | ||
4542 | 180 | |||
4543 | 181 | close(fd); | ||
4544 | 182 | } | ||
4545 | 183 | |||
4546 | 184 | g_slist_foreach(sorted, (GFunc) g_free, NULL); | ||
4547 | 185 | g_slist_free(sorted); | ||
4548 | 186 | |||
4549 | 187 | if (count) | ||
4550 | 188 | *count = n; | ||
4551 | 189 | |||
4552 | 190 | return 0; | ||
4553 | 191 | } | ||
4554 | 192 | |||
4555 | 193 | static void entry_concat(const char *filename, VObject *v, void *user_data) | ||
4556 | 194 | { | ||
4557 | 195 | GString *buffer = user_data; | ||
4558 | 196 | char tmp[1024]; | ||
4559 | 197 | int len; | ||
4560 | 198 | |||
4561 | 199 | /* | ||
4562 | 200 | * VObject API uses len for IN and OUT | ||
4563 | 201 | * Written bytes is also returned in the len variable | ||
4564 | 202 | */ | ||
4565 | 203 | len = sizeof(tmp); | ||
4566 | 204 | memset(tmp, 0, len); | ||
4567 | 205 | |||
4568 | 206 | writeMemVObject(tmp, &len, v); | ||
4569 | 207 | |||
4570 | 208 | /* FIXME: only the requested fields must be added */ | ||
4571 | 209 | g_string_append_len(buffer, tmp, len); | ||
4572 | 210 | } | ||
4573 | 211 | |||
4574 | 212 | static gboolean read_dir(void *user_data) | ||
4575 | 213 | { | ||
4576 | 214 | struct dummy_data *dummy = user_data; | ||
4577 | 215 | GString *buffer; | ||
4578 | 216 | DIR *dp; | ||
4579 | 217 | uint16_t count, max, offset; | ||
4580 | 218 | |||
4581 | 219 | buffer = g_string_new(""); | ||
4582 | 220 | |||
4583 | 221 | dp = opendir(dummy->folder); | ||
4584 | 222 | if (dp == NULL) { | ||
4585 | 223 | int err = errno; | ||
4586 | 224 | debug("opendir(): %s(%d)", strerror(err), err); | ||
4587 | 225 | goto done; | ||
4588 | 226 | } | ||
4589 | 227 | |||
4590 | 228 | /* | ||
4591 | 229 | * For PullPhoneBook function, the decision of returning the size | ||
4592 | 230 | * or contacts is made in the PBAP core. When MaxListCount is ZERO, | ||
4593 | 231 | * PCE wants to know the size of a given folder, PSE shall ignore all | ||
4594 | 232 | * other applicattion parameters that may be present in the request. | ||
4595 | 233 | */ | ||
4596 | 234 | if (dummy->apparams->maxlistcount == 0) { | ||
4597 | 235 | max = 0xffff; | ||
4598 | 236 | offset = 0; | ||
4599 | 237 | } else { | ||
4600 | 238 | max = dummy->apparams->maxlistcount; | ||
4601 | 239 | offset = dummy->apparams->liststartoffset; | ||
4602 | 240 | } | ||
4603 | 241 | |||
4604 | 242 | foreach_vcard(dp, entry_concat, offset, max, buffer, &count); | ||
4605 | 243 | |||
4606 | 244 | closedir(dp); | ||
4607 | 245 | done: | ||
4608 | 246 | /* FIXME: Missing vCards fields filtering */ | ||
4609 | 247 | dummy->cb(buffer->str, buffer->len, count, 0, dummy->user_data); | ||
4610 | 248 | |||
4611 | 249 | g_string_free(buffer, TRUE); | ||
4612 | 250 | |||
4613 | 251 | return FALSE; | ||
4614 | 252 | } | ||
4615 | 253 | |||
4616 | 254 | static void entry_notify(const char *filename, VObject *v, void *user_data) | ||
4617 | 255 | { | ||
4618 | 256 | struct cache_query *query = user_data; | ||
4619 | 257 | VObject *property, *subproperty; | ||
4620 | 258 | GString *name; | ||
4621 | 259 | const char *tel; | ||
4622 | 260 | long unsigned int handle; | ||
4623 | 261 | |||
4624 | 262 | property = isAPropertyOf(v, VCNameProp); | ||
4625 | 263 | if (!property) | ||
4626 | 264 | return; | ||
4627 | 265 | |||
4628 | 266 | if (sscanf(filename, "%lu.vcf", &handle) != 1) | ||
4629 | 267 | return; | ||
4630 | 268 | |||
4631 | 269 | if (handle > UINT32_MAX) | ||
4632 | 270 | return; | ||
4633 | 271 | |||
4634 | 272 | /* LastName; FirstName; MiddleName; Prefix; Suffix */ | ||
4635 | 273 | |||
4636 | 274 | name = g_string_new(""); | ||
4637 | 275 | subproperty = isAPropertyOf(property, VCFamilyNameProp); | ||
4638 | 276 | if (subproperty) { | ||
4639 | 277 | g_string_append(name, | ||
4640 | 278 | fakeCString(vObjectUStringZValue(subproperty))); | ||
4641 | 279 | } | ||
4642 | 280 | |||
4643 | 281 | subproperty = isAPropertyOf(property, VCGivenNameProp); | ||
4644 | 282 | if (subproperty) | ||
4645 | 283 | g_string_append_printf(name, ";%s", | ||
4646 | 284 | fakeCString(vObjectUStringZValue(subproperty))); | ||
4647 | 285 | |||
4648 | 286 | subproperty = isAPropertyOf(property, VCAdditionalNamesProp); | ||
4649 | 287 | if (subproperty) | ||
4650 | 288 | g_string_append_printf(name, ";%s", | ||
4651 | 289 | fakeCString(vObjectUStringZValue(subproperty))); | ||
4652 | 290 | |||
4653 | 291 | subproperty = isAPropertyOf(property, VCNamePrefixesProp); | ||
4654 | 292 | if (subproperty) | ||
4655 | 293 | g_string_append_printf(name, ";%s", | ||
4656 | 294 | fakeCString(vObjectUStringZValue(subproperty))); | ||
4657 | 295 | |||
4658 | 296 | |||
4659 | 297 | subproperty = isAPropertyOf(property, VCNameSuffixesProp); | ||
4660 | 298 | if (subproperty) | ||
4661 | 299 | g_string_append_printf(name, ";%s", | ||
4662 | 300 | fakeCString(vObjectUStringZValue(subproperty))); | ||
4663 | 301 | |||
4664 | 302 | property = isAPropertyOf(v, VCTelephoneProp); | ||
4665 | 303 | |||
4666 | 304 | tel = property ? fakeCString(vObjectUStringZValue(property)) : NULL; | ||
4667 | 305 | |||
4668 | 306 | query->entry_cb(filename, handle, name->str, NULL, tel, | ||
4669 | 307 | query->user_data); | ||
4670 | 308 | g_string_free(name, TRUE); | ||
4671 | 309 | } | ||
4672 | 310 | |||
4673 | 311 | static gboolean create_cache(void *user_data) | ||
4674 | 312 | { | ||
4675 | 313 | struct cache_query *query = user_data; | ||
4676 | 314 | |||
4677 | 315 | /* | ||
4678 | 316 | * MaxListCount and ListStartOffset shall not be used | ||
4679 | 317 | * when creating the cache. All entries shall be fetched. | ||
4680 | 318 | * PBAP core is responsible for consider these application | ||
4681 | 319 | * parameters before reply the entries. | ||
4682 | 320 | */ | ||
4683 | 321 | foreach_vcard(query->dp, entry_notify, 0, 0xffff, query, NULL); | ||
4684 | 322 | |||
4685 | 323 | query->ready_cb(query->user_data); | ||
4686 | 324 | |||
4687 | 325 | return FALSE; | ||
4688 | 326 | } | ||
4689 | 327 | |||
4690 | 328 | static gboolean read_entry(void *user_data) | ||
4691 | 329 | { | ||
4692 | 330 | struct dummy_data *dummy = user_data; | ||
4693 | 331 | char buffer[1024]; | ||
4694 | 332 | ssize_t count; | ||
4695 | 333 | |||
4696 | 334 | memset(buffer, 0, sizeof(buffer)); | ||
4697 | 335 | count = read(dummy->fd, buffer, sizeof(buffer)); | ||
4698 | 336 | |||
4699 | 337 | if (count < 0) { | ||
4700 | 338 | int err = errno; | ||
4701 | 339 | error("read(): %s(%d)", strerror(err), err); | ||
4702 | 340 | count = 0; | ||
4703 | 341 | } | ||
4704 | 342 | |||
4705 | 343 | /* FIXME: Missing vCards fields filtering */ | ||
4706 | 344 | |||
4707 | 345 | dummy->cb(buffer, count, 1, 0, dummy->user_data); | ||
4708 | 346 | |||
4709 | 347 | return FALSE; | ||
4710 | 348 | } | ||
4711 | 349 | |||
4712 | 350 | static gboolean is_dir(const char *dir) | ||
4713 | 351 | { | ||
4714 | 352 | struct stat st; | ||
4715 | 353 | |||
4716 | 354 | if (stat(dir, &st) < 0) { | ||
4717 | 355 | int err = errno; | ||
4718 | 356 | error("stat(%s): %s (%d)", dir, strerror(err), err); | ||
4719 | 357 | return FALSE; | ||
4720 | 358 | } | ||
4721 | 359 | |||
4722 | 360 | return S_ISDIR(st.st_mode); | ||
4723 | 361 | } | ||
4724 | 362 | |||
4725 | 363 | char *phonebook_set_folder(const char *current_folder, | ||
4726 | 364 | const char *new_folder, uint8_t flags, int *err) | ||
4727 | 365 | { | ||
4728 | 366 | gboolean root, child; | ||
4729 | 367 | char *tmp1, *tmp2, *base, *absolute, *relative = NULL; | ||
4730 | 368 | int len, ret = 0; | ||
4731 | 369 | |||
4732 | 370 | root = (g_strcmp0("/", current_folder) == 0); | ||
4733 | 371 | child = (new_folder && strlen(new_folder) != 0); | ||
4734 | 372 | |||
4735 | 373 | switch (flags) { | ||
4736 | 374 | case 0x02: | ||
4737 | 375 | /* Go back to root */ | ||
4738 | 376 | if (!child) { | ||
4739 | 377 | relative = g_strdup("/"); | ||
4740 | 378 | goto done; | ||
4741 | 379 | } | ||
4742 | 380 | |||
4743 | 381 | relative = g_build_filename(current_folder, new_folder, NULL); | ||
4744 | 382 | break; | ||
4745 | 383 | case 0x03: | ||
4746 | 384 | /* Go up 1 level */ | ||
4747 | 385 | if (root) { | ||
4748 | 386 | /* Already root */ | ||
4749 | 387 | ret = -EBADR; | ||
4750 | 388 | goto done; | ||
4751 | 389 | } | ||
4752 | 390 | |||
4753 | 391 | /* | ||
4754 | 392 | * Removing one level of the current folder. Current folder | ||
4755 | 393 | * contains AT LEAST one level since it is not at root folder. | ||
4756 | 394 | * Use glib utility functions to handle invalid chars in the | ||
4757 | 395 | * folder path properly. | ||
4758 | 396 | */ | ||
4759 | 397 | tmp1 = g_path_get_basename(current_folder); | ||
4760 | 398 | tmp2 = g_strrstr(current_folder, tmp1); | ||
4761 | 399 | len = tmp2 - (current_folder + 1); | ||
4762 | 400 | |||
4763 | 401 | g_free(tmp1); | ||
4764 | 402 | |||
4765 | 403 | if (len == 0) | ||
4766 | 404 | base = g_strdup("/"); | ||
4767 | 405 | else | ||
4768 | 406 | base = g_strndup(current_folder, len); | ||
4769 | 407 | |||
4770 | 408 | /* Return: one level only */ | ||
4771 | 409 | if (!child) { | ||
4772 | 410 | relative = base; | ||
4773 | 411 | goto done; | ||
4774 | 412 | } | ||
4775 | 413 | |||
4776 | 414 | relative = g_build_filename(base, new_folder, NULL); | ||
4777 | 415 | g_free(base); | ||
4778 | 416 | |||
4779 | 417 | break; | ||
4780 | 418 | default: | ||
4781 | 419 | ret = -EBADR; | ||
4782 | 420 | break; | ||
4783 | 421 | } | ||
4784 | 422 | |||
4785 | 423 | done: | ||
4786 | 424 | if (!relative) { | ||
4787 | 425 | if (err) | ||
4788 | 426 | *err = ret; | ||
4789 | 427 | |||
4790 | 428 | return NULL; | ||
4791 | 429 | } | ||
4792 | 430 | |||
4793 | 431 | absolute = g_build_filename(root_folder, relative, NULL); | ||
4794 | 432 | if (!is_dir(absolute)) { | ||
4795 | 433 | g_free(relative); | ||
4796 | 434 | relative = NULL; | ||
4797 | 435 | ret = -ENOENT; | ||
4798 | 436 | } | ||
4799 | 437 | |||
4800 | 438 | g_free(absolute); | ||
4801 | 439 | |||
4802 | 440 | if (err) | ||
4803 | 441 | *err = ret; | ||
4804 | 442 | |||
4805 | 443 | return relative; | ||
4806 | 444 | } | ||
4807 | 445 | |||
4808 | 446 | int phonebook_pull(const char *name, const struct apparam_field *params, | ||
4809 | 447 | phonebook_cb cb, void *user_data) | ||
4810 | 448 | { | ||
4811 | 449 | struct dummy_data *dummy; | ||
4812 | 450 | char *filename, *folder; | ||
4813 | 451 | |||
4814 | 452 | /* | ||
4815 | 453 | * Main phonebook objects will be created dinamically based on the | ||
4816 | 454 | * folder content. All vcards inside the given folder will be appended | ||
4817 | 455 | * in the "virtual" main phonebook object. | ||
4818 | 456 | */ | ||
4819 | 457 | |||
4820 | 458 | filename = g_build_filename(root_folder, name, NULL); | ||
4821 | 459 | |||
4822 | 460 | if (!g_str_has_suffix(filename, ".vcf")) { | ||
4823 | 461 | g_free(filename); | ||
4824 | 462 | return -EBADR; | ||
4825 | 463 | } | ||
4826 | 464 | |||
4827 | 465 | folder = g_strndup(filename, strlen(filename) - 4); | ||
4828 | 466 | g_free(filename); | ||
4829 | 467 | if (!is_dir(folder)) { | ||
4830 | 468 | g_free(folder); | ||
4831 | 469 | return -ENOENT; | ||
4832 | 470 | } | ||
4833 | 471 | |||
4834 | 472 | dummy = g_new0(struct dummy_data, 1); | ||
4835 | 473 | dummy->cb = cb; | ||
4836 | 474 | dummy->user_data = user_data; | ||
4837 | 475 | dummy->apparams = params; | ||
4838 | 476 | dummy->folder = folder; | ||
4839 | 477 | dummy->fd = -1; | ||
4840 | 478 | |||
4841 | 479 | g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, read_dir, dummy, dummy_free); | ||
4842 | 480 | |||
4843 | 481 | return 0; | ||
4844 | 482 | } | ||
4845 | 483 | |||
4846 | 484 | int phonebook_get_entry(const char *folder, const char *id, | ||
4847 | 485 | const struct apparam_field *params, | ||
4848 | 486 | phonebook_cb cb, void *user_data) | ||
4849 | 487 | { | ||
4850 | 488 | struct dummy_data *dummy; | ||
4851 | 489 | char *filename; | ||
4852 | 490 | int fd; | ||
4853 | 491 | |||
4854 | 492 | filename = g_build_filename(root_folder, folder, id, NULL); | ||
4855 | 493 | |||
4856 | 494 | fd = open(filename, O_RDONLY); | ||
4857 | 495 | if (fd < 0) { | ||
4858 | 496 | int err = errno; | ||
4859 | 497 | debug("open(): %s(%d)", strerror(err), err); | ||
4860 | 498 | return -ENOENT; | ||
4861 | 499 | } | ||
4862 | 500 | |||
4863 | 501 | dummy = g_new0(struct dummy_data, 1); | ||
4864 | 502 | dummy->cb = cb; | ||
4865 | 503 | dummy->user_data = user_data; | ||
4866 | 504 | dummy->apparams = params; | ||
4867 | 505 | dummy->fd = fd; | ||
4868 | 506 | |||
4869 | 507 | g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, read_entry, dummy, dummy_free); | ||
4870 | 508 | |||
4871 | 509 | return 0; | ||
4872 | 510 | } | ||
4873 | 511 | |||
4874 | 512 | int phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb, | ||
4875 | 513 | phonebook_cache_ready_cb ready_cb, void *user_data) | ||
4876 | 514 | { | ||
4877 | 515 | struct cache_query *query; | ||
4878 | 516 | char *foldername; | ||
4879 | 517 | DIR *dp; | ||
4880 | 518 | |||
4881 | 519 | foldername = g_build_filename(root_folder, name, NULL); | ||
4882 | 520 | dp = opendir(foldername); | ||
4883 | 521 | g_free(foldername); | ||
4884 | 522 | |||
4885 | 523 | if (dp == NULL) { | ||
4886 | 524 | int err = errno; | ||
4887 | 525 | debug("opendir(): %s(%d)", strerror(err), err); | ||
4888 | 526 | return -ENOENT; | ||
4889 | 527 | } | ||
4890 | 528 | |||
4891 | 529 | query = g_new0(struct cache_query, 1); | ||
4892 | 530 | query->entry_cb = entry_cb; | ||
4893 | 531 | query->ready_cb = ready_cb; | ||
4894 | 532 | query->user_data = user_data; | ||
4895 | 533 | query->dp = dp; | ||
4896 | 534 | |||
4897 | 535 | g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, create_cache, query, | ||
4898 | 536 | query_free); | ||
4899 | 85 | return 0; | 537 | return 0; |
4900 | 86 | } | 538 | } |
4901 | 87 | 539 | ||
4902 | === modified file 'plugins/phonebook-ebook.c' | |||
4903 | --- plugins/phonebook-ebook.c 2010-04-27 04:17:15 +0000 | |||
4904 | +++ plugins/phonebook-ebook.c 2010-06-15 19:18:33 +0000 | |||
4905 | @@ -41,54 +41,250 @@ | |||
4906 | 41 | #include "service.h" | 41 | #include "service.h" |
4907 | 42 | #include "phonebook.h" | 42 | #include "phonebook.h" |
4908 | 43 | 43 | ||
4918 | 44 | #define EOL_CHARS "\n" | 44 | #define QUERY_FN "(contains \"family_name\" \"%s\")" |
4919 | 45 | #define VL_VERSION "<?xml version=\"1.0\"?>" EOL_CHARS | 45 | #define QUERY_NAME "(contains \"given_name\" \"%s\")" |
4911 | 46 | #define VL_TYPE "<!DOCTYPE vcard-listing SYSTEM \"vcard-listing.dtd\">" EOL_CHARS | ||
4912 | 47 | #define VL_BODY_BEGIN "<vCard-listing version=\"1.0\">" EOL_CHARS | ||
4913 | 48 | #define VL_BODY_END "</vCard-listing>" EOL_CHARS | ||
4914 | 49 | #define VL_ELEMENT "<card handle = \"%d.vcf\" name = \"%s\"/>" EOL_CHARS | ||
4915 | 50 | |||
4916 | 51 | #define QUERY_FAMILY_NAME "(contains \"family_name\" \"%s\")" | ||
4917 | 52 | #define QUERY_GIVEN_NAME "(contains \"given_name\" \"%s\")" | ||
4920 | 53 | #define QUERY_PHONE "(contains \"phone\" \"%s\")" | 46 | #define QUERY_PHONE "(contains \"phone\" \"%s\")" |
4921 | 54 | 47 | ||
4923 | 55 | struct query_data { | 48 | struct contacts_query { |
4924 | 56 | const struct apparam_field *params; | 49 | const struct apparam_field *params; |
4925 | 57 | phonebook_cb cb; | 50 | phonebook_cb cb; |
4927 | 58 | gpointer user_data; | 51 | void *user_data; |
4928 | 52 | }; | ||
4929 | 53 | |||
4930 | 54 | struct cache_query { | ||
4931 | 55 | phonebook_entry_cb entry_cb; | ||
4932 | 56 | phonebook_cache_ready_cb ready_cb; | ||
4933 | 57 | void *user_data; | ||
4934 | 59 | }; | 58 | }; |
4935 | 60 | 59 | ||
4936 | 61 | static EBook *ebook = NULL; | 60 | static EBook *ebook = NULL; |
4937 | 62 | 61 | ||
4942 | 63 | static void ebookpull_cb(EBook *book, EBookStatus status, GList *contacts, | 62 | static char *attribute_mask[] = { |
4943 | 64 | gpointer user_data) | 63 | /* 0 */ "VERSION", |
4944 | 65 | { | 64 | "FN", |
4945 | 66 | struct query_data *data = user_data; | 65 | "N", |
4946 | 66 | "PHOTO", | ||
4947 | 67 | "BDAY", | ||
4948 | 68 | "ADR", | ||
4949 | 69 | "LABEL", | ||
4950 | 70 | "TEL", | ||
4951 | 71 | /* 8 */ "EMAIL", | ||
4952 | 72 | "MAILER", | ||
4953 | 73 | "TZ", | ||
4954 | 74 | "GEO", | ||
4955 | 75 | "TITLE", | ||
4956 | 76 | "ROLE", | ||
4957 | 77 | "LOGO", | ||
4958 | 78 | "AGENT", | ||
4959 | 79 | /* 16 */ "ORG", | ||
4960 | 80 | "NOTE", | ||
4961 | 81 | "REV", | ||
4962 | 82 | "SOUND", | ||
4963 | 83 | "URL", | ||
4964 | 84 | "UID", | ||
4965 | 85 | "KEY", | ||
4966 | 86 | "NICKNAME", | ||
4967 | 87 | /* 24 */ "CATEGORIES", | ||
4968 | 88 | "PROID", | ||
4969 | 89 | "CLASS", | ||
4970 | 90 | "SORT-STRING", | ||
4971 | 91 | /* 28 */ "X-IRMC-CALL-DATETIME", | ||
4972 | 92 | NULL | ||
4973 | 93 | |||
4974 | 94 | }; | ||
4975 | 95 | |||
4976 | 96 | static char *evcard_to_string(EVCard *evcard, unsigned int format, | ||
4977 | 97 | uint64_t filter) | ||
4978 | 98 | { | ||
4979 | 99 | EVCard *evcard2; | ||
4980 | 100 | char *vcard; | ||
4981 | 101 | unsigned int i; | ||
4982 | 102 | |||
4983 | 103 | if (!filter) | ||
4984 | 104 | return e_vcard_to_string(evcard, format); | ||
4985 | 105 | |||
4986 | 106 | /* | ||
4987 | 107 | * Mandatory attributes for vCard 2.1 are VERSION ,N and TEL. | ||
4988 | 108 | * Mandatory attributes for vCard 3.0 are VERSION, N, FN and TEL | ||
4989 | 109 | */ | ||
4990 | 110 | filter = format == EVC_FORMAT_VCARD_30 ? filter | 0x85: filter | 0x87; | ||
4991 | 111 | |||
4992 | 112 | evcard2 = e_vcard_new(); | ||
4993 | 113 | for (i = 0; i < 29; i++) { | ||
4994 | 114 | EVCardAttribute *attrib; | ||
4995 | 115 | |||
4996 | 116 | if (!(filter & (1 << i))) | ||
4997 | 117 | continue; | ||
4998 | 118 | |||
4999 | 119 | attrib = e_vcard_get_attribute(evcard, attribute_mask[i]); | ||
5000 | 120 | if (!attrib) |
The diff has been truncated for viewing.