[PATCH] DLD upload

Robert C. Helling helling at atdotde.de
Wed Mar 13 06:08:09 PDT 2013


A non-text attachment was scrubbed...
Name: DLD_upload.patch
Type: application/octet-stream
Size: 2900 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130313/f8cb4d7e/attachment.obj>
-------------- next part --------------


Hi,

in the tradition of sending something semi-working in the hope somebody else finishes it, here is an implementation of the actual upload to divelogs.de.

There are a number of things to note:

1) I was not able to understand the libsoup documentation as how one is supposed to upload a file (together with parameters in a POST operation). Thus I used libcurl. As I did this on my Mac I had to port install curl. I changed the Makefile accordingly.

2) On divelogs.de, I created an account "subsurface" test with password "geheim". Currently, these are hardcoded in divelist.c as I did not have time to learn how to modify the GUI to obtain this information from the user. 

4) There is no error handling so far. Instead libcurl prints the result (some xml) to STDOUT and I have not yet figured out how to stop it. 

5) My indentation is still horrible. All the .emacs stuff you friendly people sent so far did not help. I am really sorry about this. 

6) I adopted this code from a coding example from the libcurl doc. That came with a boiler plate /***************************************************************************
 *                                  _   _ ____  _
 *  Project                     ___| | | |  _ \| |
 *                             / __| | | | |_) | |
 *                            | (__| |_| |  _ <| |___
 *                             \___|\___/|_| \_\_____|
 *
 * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel at haxx.se>, et al.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution. The terms
 * are also available at http://curl.haxx.se/docs/copyright.html.
 *
 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
 * copies of the Software, and permit persons to whom the Software is
 * furnished to do so, under the terms of the COPYING file.
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 * KIND, either express or implied.
 *
 ***************************************************************************/
I understand, libcurl comes with a MIT license. I don't know if this creates any problems if it is included in a GPL'ed project. We might have to ask the curl author for permission.

If you still don't mind:

Signed-off-by: Robert C. Helling <helling at atdotde.de>

Best
Robert
--                                                                              
.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oO 
Robert C. Helling     Elite Master Course Theoretical and Mathematical Physics  
                      Scientific Coordinator                                   
                      Ludwig Maximilians Universitaet Muenchen, Dept. Physik    
print "Just another   Phone: +49 89 2180-4523  Theresienstr. 39, rm. B339       
    stupid .sig\n";   http://www.atdotde.de 



More information about the subsurface mailing list