~ubuntu-branches/debian/sid/flickcurl/sid

« back to all changes in this revision

Viewing changes to src/photos-notes-api.c

  • Committer: Package Import Robot
  • Author(s): Kumar Appaiah
  • Date: 2013-05-20 21:15:09 UTC
  • mfrom: (1.4.1) (15.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130520211509-e701o5dlwa04aqiw
Tags: 1.24-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 *
3
3
 * photos-notes-api.c - Flickr flickr.photos.notes.* API calls
4
4
 *
5
 
 * Copyright (C) 2007-2008, David Beckett http://www.dajobe.org/
 
5
 * Copyright (C) 2007-2012, David Beckett http://www.dajobe.org/
6
6
 * 
7
7
 * This file is licensed under the following three licenses as alternatives:
8
8
 *   1. GNU Lesser General Public License (LGPL) V2.1 or any newer version
66
66
                           int note_x, int note_y, int note_w, int note_h,
67
67
                           const char* note_text)
68
68
{
69
 
  const char* parameters[13][2];
70
 
  int count = 0;
71
69
  xmlDocPtr doc = NULL;
72
70
  xmlXPathContextPtr xpathCtx = NULL; 
73
71
  char *id = NULL;
76
74
  char note_w_s[10];
77
75
  char note_h_s[10];
78
76
  
 
77
  flickcurl_init_params(fc);
 
78
 
79
79
  if(!photo_id || !note_text)
80
80
    return NULL;
81
81
 
82
 
  parameters[count][0]  = "photo_id";
83
 
  parameters[count++][1]= photo_id;
84
 
  parameters[count][0]  = "note_x";
 
82
  flickcurl_add_param(fc, "photo_id", photo_id);
85
83
  sprintf(note_x_s, "%d", note_x);
86
 
  parameters[count++][1]= note_x_s;
87
 
  parameters[count][0]  = "note_y";
 
84
  flickcurl_add_param(fc, "note_x", note_x_s);
88
85
  sprintf(note_y_s, "%d", note_y);
89
 
  parameters[count++][1]= note_y_s;
90
 
  parameters[count][0]  = "note_w";
 
86
  flickcurl_add_param(fc, "note_y", note_y_s);
91
87
  sprintf(note_w_s, "%d", note_w);
92
 
  parameters[count++][1]= note_w_s;
93
 
  parameters[count][0]  = "note_h";
 
88
  flickcurl_add_param(fc, "note_w", note_w_s);
94
89
  sprintf(note_h_s, "%d", note_h);
95
 
  parameters[count++][1]= note_h_s;
96
 
  parameters[count][0]  = "note_text";
97
 
  parameters[count++][1]= note_text;
98
 
 
99
 
  parameters[count][0]  = NULL;
100
 
 
101
 
  if(flickcurl_prepare(fc, "flickr.photos.notes.add", parameters, count))
 
90
  flickcurl_add_param(fc, "note_h", note_h_s);
 
91
  flickcurl_add_param(fc, "note_text", note_text);
 
92
 
 
93
  flickcurl_end_params(fc);
 
94
 
 
95
  if(flickcurl_prepare(fc, "flickr.photos.notes.add"))
102
96
    goto tidy;
103
97
 
104
98
  flickcurl_set_write(fc, 1);
143
137
int
144
138
flickcurl_photos_notes_delete(flickcurl* fc, const char* note_id)
145
139
{
146
 
  const char* parameters[8][2];
147
 
  int count = 0;
148
140
  xmlDocPtr doc = NULL;
149
141
  int result = 1;
150
142
  
 
143
  flickcurl_init_params(fc);
 
144
 
151
145
  if(!note_id)
152
146
    return 1;
153
147
 
154
 
  parameters[count][0]  = "note_id";
155
 
  parameters[count++][1]= note_id;
156
 
 
157
 
  parameters[count][0]  = NULL;
158
 
 
159
 
  if(flickcurl_prepare(fc, "flickr.photos.notes.delete", parameters, count))
 
148
  flickcurl_add_param(fc, "note_id", note_id);
 
149
 
 
150
  flickcurl_end_params(fc);
 
151
 
 
152
  if(flickcurl_prepare(fc, "flickr.photos.notes.delete"))
160
153
    goto tidy;
161
154
 
162
155
  flickcurl_set_write(fc, 1);
199
192
                            int note_x, int note_y, int note_w, int note_h,
200
193
                            const char* note_text)
201
194
{
202
 
  const char* parameters[13][2];
203
 
  int count = 0;
204
195
  xmlDocPtr doc = NULL;
205
196
  int result = 1;
206
197
  char note_x_s[10];
208
199
  char note_w_s[10];
209
200
  char note_h_s[10];
210
201
  
 
202
  flickcurl_init_params(fc);
 
203
 
211
204
  if(!note_id || !note_text)
212
205
    return 1;
213
206
 
214
 
  parameters[count][0]  = "note_id";
215
 
  parameters[count++][1]= note_id;
216
 
  parameters[count][0]  = "note_x";
 
207
  flickcurl_add_param(fc, "note_id", note_id);
217
208
  sprintf(note_x_s, "%d", note_x);
218
 
  parameters[count++][1]= note_x_s;
219
 
  parameters[count][0]  = "note_y";
 
209
  flickcurl_add_param(fc, "note_x", note_x_s);
220
210
  sprintf(note_y_s, "%d", note_y);
221
 
  parameters[count++][1]= note_y_s;
222
 
  parameters[count][0]  = "note_w";
 
211
  flickcurl_add_param(fc, "note_y", note_y_s);
223
212
  sprintf(note_w_s, "%d", note_w);
224
 
  parameters[count++][1]= note_w_s;
225
 
  parameters[count][0]  = "note_h";
 
213
  flickcurl_add_param(fc, "note_w", note_w_s);
226
214
  sprintf(note_h_s, "%d", note_h);
227
 
  parameters[count++][1]= note_h_s;
228
 
  parameters[count][0]  = "note_text";
229
 
  parameters[count++][1]= note_text;
230
 
 
231
 
  parameters[count][0]  = NULL;
232
 
 
233
 
  if(flickcurl_prepare(fc, "flickr.photos.notes.edit", parameters, count))
 
215
  flickcurl_add_param(fc, "note_h", note_h_s);
 
216
  flickcurl_add_param(fc, "note_text", note_text);
 
217
 
 
218
  flickcurl_end_params(fc);
 
219
 
 
220
  if(flickcurl_prepare(fc, "flickr.photos.notes.edit"))
234
221
    goto tidy;
235
222
 
236
223
  flickcurl_set_write(fc, 1);